A Sumor Cloud Tool.
More Documentation
This is a lightweight storage library for Node.JS. It can connect to various storage services, such as Aliyun OSS
npm i @sumor/storage --save
Require Node.JS version 18.x or above
As this package is written in ES module,
please change the following code in your package.json
file:
{
"type": "module"
}
import { Storage } from '@sumor/storage'
const storage = new Storage(config)
example for aliyun OSS
{
"type": "aliyunOSS",
"accessKeyId": "xxxx",
"accessKeySecret": "xxx",
"region": "oss-us-west-1",
"bucket": "sumor-cloud"
}
put content support text, buffer, stream
import { Storage } from '@sumor/storage'
const storage = new Storage(config)
const filename = 'demo.txt'
const content = 'Hello World'
const result = await storage.put(filename, content)
import { Storage } from '@sumor/storage'
const storage = new Storage(config)
const filename = 'demo.txt'
const result = await storage.get(filename)
import { Storage } from '@sumor/storage'
const storage = new Storage(config)
const filename = 'demo.txt'
const result = await storage.delete(filename)