Showing content from https://github.com/cnpm/cnpmjs.org/wiki/NFS-Guide below:
NFS Guide · cnpm/cnpmjs.org Wiki · GitHub
cnpmjs.org support custom storage, but all the storage need follow the rules:
- async function upload(filepath, options)
- filepath: upload file path
- options
- key: identifie of this file
- size: file size
- async function uploadBuffer(fileBuffer, options)
- fileBuffer: upload file content buffer
- options
- key: identifie of this file
- size: fileBuffer size
- shasum: fileBuffer sha1
- shasum256: fileBuffer sha256
- async function remove(key)
- async function download(key, savePath, options)[optional]
- key: file identifie
- savePath: download path
- options
- async function createDownloadStream(key, options)[optional]
- key: file identifie
- options
- return
{ReadStream}
- async function url(key)[optional]
url
method should be async function
too.
- async function readBytes(key, options)[optional]
- key: file identifie
- options
- async function appendBuffer(fileBuffer, options)[optional]
- fileBuffer: upload file content buffer
- options
- key: identifie of this file
All function are async
function.
- Can download the uploaded file through http request. like qn-cnpm.
uploadBuffer
: use options.key
to customize the filename, then callback {url: 'http://test.com/xxx.tgz'}
.
url
: accept a key
and respond download url.
remove
: remove file by key
- Can not download by http request. like sfs-client or oss-cnpm.
uploadBuffer
: upload the file, and must callback {key: 'xxx'}
, so cnpmjs.org can record the key, and use this key to download or remove.
download
: need provide download api to download the file by key.
createDownloadStream
: streaming download file by key
remove
: remove file by key
RetroSearch is an open source project built by @garambo
| Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4