This repository was archived by the owner on Jun 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 738
NFS Guide
fengmk2 edited this page Apr 11, 2015
·
30 revisions
cnpmjs.org support custom storage, but all the storage need follow the rules:
-
function upload(filepath, options)*
- filepath: upload file path
- options
- key: identifie of this file
- size: file size
-
function uploadBuffer(fileBuffer, options)*
- fileBuffer: upload file content buffer
- options
- key: identifie of this file
- size: file size
-
function remove(key)*
- key: file identifie
-
function download(key, savePath, options)*[optional]
- key: file identifie
- savePath: download path
- options
- timeout
-
function createStream(key, options)*[optional]
- key: file identifie
- options
- timeout
-
function url(key)[optional]
- key: file identifie
upload, uploadBuffer, download, createStream, and remove need be yieldables.
- Can download the uploaded file through http request. like qn-cnpm.
-
uploadBuffer: useoptions.keyto customize the filename, then callback{url: 'http://test.com/xxx.tgz'}. -
url: accept akeyand 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. -
remove: remove file by key
Copyright @ 2013 - present cnpmjs.org