@digidem/atomic-fs-blob-store
Advanced tools
Comparing version 5.3.0 to 5.3.1
31
index.js
@@ -38,2 +38,3 @@ var mkdirp = require('mkdirp') | ||
if (opts.name && !opts.key) opts.key = opts.name | ||
cb = cb || function () {} | ||
@@ -45,15 +46,25 @@ var key = join(this.path, opts.key) | ||
if (cache.get(dir)) return listen(createWriteStream(key, opts), opts, cb) | ||
var proxy = duplexify() | ||
proxy.setReadable(false) | ||
var proxy = listen(duplexify(), opts, cb) | ||
function setup () { | ||
var w = createWriteStream(key, opts) | ||
w.once('finish', function () { | ||
cb(null, opts) | ||
}) | ||
w.once('error', cb) | ||
proxy.setWritable(w) | ||
} | ||
proxy.setReadable(false) | ||
if (cache.get(dir)) { | ||
setup() | ||
} else { | ||
mkdirp(dir, function(err) { | ||
if (proxy.destroyed) return | ||
if (err) return proxy.destroy(err) | ||
cache.set(dir, true) | ||
setup() | ||
}) | ||
} | ||
mkdirp(dir, function(err) { | ||
if (proxy.destroyed) return | ||
if (err) return proxy.destroy(err) | ||
cache.set(dir, true) | ||
proxy.setWritable(createWriteStream(key, opts)) | ||
}) | ||
return proxy | ||
@@ -60,0 +71,0 @@ } |
{ | ||
"name": "@digidem/atomic-fs-blob-store", | ||
"version": "5.3.0", | ||
"version": "5.3.1", | ||
"description": "blob store that stores blobs on the local file system (like fs-blob-store but atomic)", | ||
@@ -14,3 +14,3 @@ "main": "index.js", | ||
"devDependencies": { | ||
"abstract-blob-store": "^3.1.0", | ||
"abstract-blob-store": "~3.2.0", | ||
"rimraf": "^2.2.8", | ||
@@ -17,0 +17,0 @@ "tape": "^2.14.0" |
# atomic-fs-blob-store | ||
[![Build Status](https://travis-ci.com/digidem/atomic-fs-blob-store.svg?branch=master)](https://travis-ci.com/digidem/atomic-fs-blob-store) | ||
[![blob-store-compatible](https://raw.githubusercontent.com/maxogden/abstract-blob-store/master/badge.png)](https://github.com/maxogden/abstract-blob-store) | ||
[blob store](https://github.com/maxogden/abstract-blob-store) that atomically stores blobs (e.g. no partial writes) on the local file system. | ||
@@ -11,6 +14,2 @@ | ||
[![build status](http://img.shields.io/travis/blockai/atomic-fs-blob-store.svg?style=flat)](http://travis-ci.org/blockai/atomic-fs-blob-store) | ||
[![blob-store-compatible](https://raw.githubusercontent.com/maxogden/abstract-blob-store/master/badge.png)](https://github.com/maxogden/abstract-blob-store) | ||
## Usage | ||
@@ -17,0 +16,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7435
134
50