Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/binded/store-uploader
store-uploader (oli: I think that's deprecated)
https://github.com/binded/store-uploader
Last synced: about 5 hours ago
JSON representation
store-uploader (oli: I think that's deprecated)
- Host: GitHub
- URL: https://github.com/binded/store-uploader
- Owner: binded
- License: mit
- Created: 2016-09-01T20:15:23.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2016-09-01T21:57:39.000Z (about 8 years ago)
- Last Synced: 2024-11-15T20:41:28.769Z (2 days ago)
- Language: JavaScript
- Homepage:
- Size: 2.29 MB
- Stars: 0
- Watchers: 9
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# store-uploader
[![Build Status](https://travis-ci.org/blockai/store-uploader.svg?branch=master)](https://travis-ci.org/blockai/store-uploader)
Wrapper around
[abstract-blob-store](https://github.com/maxogden/abstract-blob-store)
to upload a stream and get back a series of hash digests, the size of
the file and the key it was stored to.## Install
```bash
npm install --save store-uploader
```Requires Node v6+
## Usage
See [./test](./test) directory for usage examples.
```javascript
import storeUploader from 'store-uploader'
import blobFs from 'fs-blob-store'
import fs from 'fs'const store = blobFs('./directory')
const upload = storeUploader(store)
// storeUploader(store[, opts])
// opts.keyPrefix prefix keys with this string (defaults to uploads/)
// opts.algos hash algorithms (defaults to ['sha1', 'md5', 'sha256'])// upload(readStream[, opts])
// opts.contentType optional content type
upload(fs.createReadStream('./somefile'))
.then(({ digests, size, key }) => {
// digests is an object: { sha1: '...', md5: '...', sha256: '...' }
// size is the size of the stream in bytes
// key is the key where the stream was uploaded
})
.catch((err) => {
// handle error...
})
```