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 Jan 14, 2014
·
30 revisions
cnpmjs.org support custom nfs, but all the nfs need follow the rules:
- upload(filePath, options, callback):
- uploadBuffer(fileBuffer, options, callback)
- remove(key)
- url(key)[optional]
- downloadStream(key, writeStream, options, callback)[optional]
- download(key, savePath, options, callback)[optional]
PS: cnpm will try to use downloadStream() first.
- Can custom the filename by key, and download by http request. see qnfs.
-
uploadanduploadBufferuseoptions.keyto custom the filename, then callback{url: 'http://test.com/xxx.tgz'}. -
urlusekeyto generate a download url.
- Random filename, and can not download by http request. see tfs-cnpm or sfs-client.
-
uploadanduploadBufferupload the file, and must callback{key: 'xxx'}, so cnpmjs.org can record the key, and use this key to download or remove. - Must implement
downloadStreamordownloadapi to download the file by key.
- Random filename, and can download by http request.
-
uploadanduploadBuffercallback{url: 'http://test.com/xxx.tgz'}, so cnpmjs.org can record the url, when user request this module, we will redirect them to this url.
Copyright @ 2013 - present cnpmjs.org