0.0.1 • Published 5 years ago

@zingle/redisdrop v0.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

Redis Dropbox: redisdrop

Create a function to drop files into a Redis list.

Example

const fs = require("fs");
const s3drop = require("redisdrop");
const endpoint = "redis://localhost:6379";
const keyspace = "dropbox:";
const filename = "my-file.txt";
const sender = "jdoe";
const keyfield = "sender"
const file = fs.createReadStream(filename);

// create drop function for redis list
const drop = redisdrop(endpoint, {keyspace, keyfield});

// set arbitrary metadata
const metadata = {filename, sender};

// use drop function to store file to S3
drop(file, metadata).then(key => {
    console.log(`saved attachment to '${key}' list at endpoint ${endpoint}`);
}).catch(err => {
    console.error(err.message);
});