Package Exports
- now-storage
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (now-storage) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
now-storage
Use Now static deployments to upload and store files.
Usage
Install it:
yarn add now-storage
# npm i now-storageThen load it inside your app.
const { upload } = require('now-storage');And call the upload function with the Now token and the file to upload.
const { url } = await upload(process.env.NOW_TOKEN, {
name: 'my-file.txt',
content: 'This is a file uploaded with now-storage.'
});The url is going to be a string similar to http://now-storage-bmjowtcani.now.sh/.
Configuration
All the deployments are going to have the name now-storage and the upload function is going to retry maximum 3 times to upload the file and another 3 times to create the deployment.
That could be configured passing a third argument to the upload method with an object using the following format.
const config = {
deploymentName: 'now-storage',
retry: {
retries: 3
}
};That's the default configuration, the retry key could receive any configuration from async-retry.