GithubHelp home page GithubHelp logo

isabella232 / waterline-blob Goto Github PK

View Code? Open in Web Editor NEW

This project forked from balderdashy/waterline-blob

0.0 0.0 0.0 267 KB

Factory which generates waterline adapter definitions from blob definitions (eventually merge into waterline core)

JavaScript 100.00%

waterline-blob's Introduction

#waterline-blob

Factory method which generates waterline adapter definitions from blob adapter definitions

This should eventually be dmerge into waterline core

Usage

// Your blob adapter definition
// (should have methods `read` and `write`)
var BlobAdapterDefinition = { /* ... */ };

// **BAM**
var AdapterFactory = require('waterline-blob');

// Your ready-to-go sails/waterline-compatible adapter definition
var AdapterDef = AdapterFactory( BlobAdapterDefinition );

Writing Your Own Blob Adapter

You can export up to two methods from a BlobAdapter definition: write() and read().

 /**
	 * `Adapter.write( uploadStream, [options], [cb] )`
	 *
	 * Pipe initial FieldStreams (files) into a destination stream,
	 * then set up events to automatically pipe the FieldStream of any newly detected file
	 * from the UploadStream to the destination stream
	 *
	 * @param {Stream} `uploadStream`	::	contains paused field streams 
	 *										and fires when new ones are added
	 * @param {Object} `options`
	 *			container		: {String} directory path where file(s) sould be stored
	 *			maxBytes		: {Integer} Maximum combined size of all files together (default 1GB)
	 *			maxBytesPerFile	: {Integer} Maximum file size for each individual file (default 25MB)
	 */
/**
 * Usages:
 * 
 * Adapter.read()
 * Adapter.read(destinationStream)
 * Adapter.read(cb)
 * Adapter.read({})
 * Adapter.read({}, cb)
 * Adapter.read({}, destinationStream)
 * Adapter.read({}, destinationStream, cb)
 */

waterline-blob's People

Contributors

mikermcneil avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.