fs-blob-storage
Advanced tools
Comparing version 0.3.0 to 0.4.0
# Changelog | ||
## v0.4.0 2018-05-15 | ||
* Breaking change: `encoding` is `null` by default and then storage object | ||
returns `Buffer`. | ||
## v0.3.0 2018-05-13 | ||
@@ -4,0 +9,0 @@ |
@@ -61,3 +61,3 @@ const fs = require('fs') | ||
createWriteStream (key, options = {}) { | ||
const { ext = DEFAULT_EXT, part = DEFAULT_PART, encoding = 'utf8' } = options | ||
const { ext = DEFAULT_EXT, part = DEFAULT_PART, encoding = null } = options | ||
const filepath = path.join(this.path, key + ext) | ||
@@ -97,3 +97,3 @@ const dirpath = path.dirname(filepath) | ||
createReadStream (key, options = {}) { | ||
const { ext = DEFAULT_EXT, encoding = 'utf8' } = options | ||
const { ext = DEFAULT_EXT, encoding = null } = options | ||
const filepath = path.join(this.path, key + ext) | ||
@@ -100,0 +100,0 @@ |
{ | ||
"name": "fs-blob-storage", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "Blob storage on filesystem with promises API", | ||
@@ -32,3 +32,3 @@ "main": "lib/fs-blob-storage.js", | ||
"@types/make-dir": "^1.0.3", | ||
"@types/node": "^10.0.6", | ||
"@types/node": "^10.0.10", | ||
"@types/pump": "^1.0.1", | ||
@@ -52,3 +52,4 @@ "chai": "^4.1.2", | ||
"pretest": "standard --verbose | snazzy && tsc --noEmit --pretty && tslint -t stylish -p . && echo markdownlint *.md", | ||
"test": "tap test/*.js", | ||
"test": "npm run test:api", | ||
"test:api": "tap test/*.js", | ||
"test:coverage": "npm test -- --coverage" | ||
@@ -55,0 +56,0 @@ }, |
@@ -68,3 +68,3 @@ # fs-blob-storage | ||
(optional, default: ".part") | ||
* `encoding` is a encoding for created file (optional, default: "utf8") | ||
* `encoding` is a encoding for created file (optional, default: `null`) | ||
@@ -71,0 +71,0 @@ Creates a writable stream for a new object in the storage. Object is stored with |
@@ -70,3 +70,3 @@ 'use strict' | ||
const content = fs.readFileSync(realFilename, { encoding: 'utf8' }) | ||
content.should.deep.equal('new content here') | ||
content.should.equal('new content here') | ||
}) | ||
@@ -116,3 +116,3 @@ | ||
const content = fs.readFileSync(realFilename, { encoding: 'utf8' }) | ||
content.should.deep.equal('new content here') | ||
content.should.equal('new content here') | ||
}) | ||
@@ -119,0 +119,0 @@ |
@@ -71,3 +71,3 @@ 'use strict' | ||
const content = fs.readFileSync(realFilename, { encoding: 'utf8' }) | ||
content.should.deep.equal('new content here') | ||
content.should.equal('new content here') | ||
}) | ||
@@ -107,3 +107,3 @@ | ||
const promiseReadable = new PromiseReadable(readable) | ||
return promiseReadable.read().should.eventually.equal('file content here') | ||
return promiseReadable.read().should.eventually.deep.equal(Buffer.from('file content here')) | ||
}) | ||
@@ -110,0 +110,0 @@ |
@@ -70,3 +70,3 @@ 'use strict' | ||
const content = fs.readFileSync(realFilename, { encoding: 'utf8' }) | ||
content.should.deep.equal('new content here') | ||
content.should.equal('new content here') | ||
}) | ||
@@ -94,3 +94,3 @@ | ||
When('key test is passed in', () => { | ||
return storage.createReadStream(testKey, { ext: '.txt' }) | ||
return storage.createReadStream(testKey, { ext: '.txt', encoding: 'utf8' }) | ||
.then((value) => { | ||
@@ -97,0 +97,0 @@ readable = value |
@@ -116,3 +116,3 @@ 'use strict' | ||
const promiseReadable = new PromiseReadable(readable) | ||
return promiseReadable.read().should.eventually.equal('file content here') | ||
return promiseReadable.read().should.eventually.deep.equal(Buffer.from('file content here')) | ||
}) | ||
@@ -119,0 +119,0 @@ |
Sorry, the diff of this file is not supported yet
38122