# waterline-blob

> Generic helper logic for building a waterline/sails blob adapter

Latest version **0.0.9** (published 2013-10-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install waterline-blob
pnpm add waterline-blob
yarn add waterline-blob
bun add waterline-blob
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.9 |
| Published | 2013-10-21 |
| First published | 2013-10-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+5 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Mike McNeil |
| Maintainers | balderdashy |
| Keywords | blob, waterline, sails, adapter, custom |

## Links

- npm: https://www.npmjs.com/package/waterline-blob
- Repository: https://github.com/balderdashy/waterline-blob
- Issues: https://github.com/balderdashy/waterline-blob/issues
- npm.io page: https://npm.io/package/waterline-blob

## Dependencies (3)

- [mime](https://npm.io/package/mime.md) ~1.2.11
- [lodash](https://npm.io/package/lodash.md) ~2.2.0
- [archiver](https://npm.io/package/archiver.md) ~0.4.10

## Recent versions

- 0.0.9 (latest) — 2013-10-21
- 0.0.8 — 2013-10-21
- 0.0.7 — 2013-10-11
- 0.0.6 — 2013-10-11
- 0.0.5 — 2013-10-02
- 0.0.4 — 2013-10-02
- 0.0.3 — 2013-10-02
- 0.0.2 — 2013-10-01

## README

#waterline-blob

Factory method which generates waterline adapter definitions from blob adapter definitions

> This should eventually be dmerge into waterline core


### Usage

```javascript

// 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()`.


```javascript
 /**
	 * `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)
	 */
```

```javascript
/**
 * Usages:
 * 
 * Adapter.read()
 * Adapter.read(destinationStream)
 * Adapter.read(cb)
 * Adapter.read({})
 * Adapter.read({}, cb)
 * Adapter.read({}, destinationStream)
 * Adapter.read({}, destinationStream, cb)
 */
 ```

---
_Source: https://npm.io/package/waterline-blob · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
