保存
This commit is contained in:
11
mail-worker/src/service/r2-service.js
Normal file
11
mail-worker/src/service/r2-service.js
Normal file
@@ -0,0 +1,11 @@
|
||||
const r2Service = {
|
||||
async putObj(c, key, content, metadata) {
|
||||
const body = typeof content === 'string'
|
||||
? new TextEncoder().encode(content)
|
||||
: content;
|
||||
await c.env.r2.put(key, body, {
|
||||
httpMetadata: {...metadata}
|
||||
});
|
||||
}
|
||||
};
|
||||
export default r2Service;
|
||||
Reference in New Issue
Block a user