Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Commit

Permalink
fix: support all the Buffer shims and load fixtures correctly
Browse files Browse the repository at this point in the history
* test: add failing test with Buffer package

* chore

* fix: fixtures are loaded using the same call in node and browser

* chore: update deps

* chore: update deps
  • Loading branch information
daviddias authored Feb 12, 2018
1 parent debb1e0 commit 066988f
Show file tree
Hide file tree
Showing 6 changed files with 205 additions and 332 deletions.
2 changes: 1 addition & 1 deletion .aegir.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const server = createServer()
module.exports = {
karma: {
files: [{
pattern: 'node_modules/interface-ipfs-core/test/fixtures/**/*',
pattern: 'node_modules/interface-ipfs-core/js/test/fixtures/**/*',
watched: false,
served: true,
included: false
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"glob": "^7.1.2",
"ipfs-block": "~0.6.1",
"ipfs-unixfs": "~0.1.14",
"ipld-dag-pb": "~0.11.4",
"ipld-dag-pb": "~0.13.0",
"is-ipfs": "^0.3.2",
"is-stream": "^1.1.0",
"lru-cache": "^4.1.1",
Expand Down Expand Up @@ -65,13 +65,13 @@
"url": "https://github.com/ipfs/js-ipfs-api"
},
"devDependencies": {
"aegir": "^12.4.0",
"aegir": "^13.0.0",
"chai": "^4.1.2",
"dirty-chai": "^2.0.1",
"eslint-plugin-react": "^7.6.1",
"go-ipfs-dep": "^0.4.13",
"gulp": "^3.9.1",
"interface-ipfs-core": "~0.48.0",
"interface-ipfs-core": "~0.49.1",
"hapi": "^17.2.0",
"ipfsd-ctl": "~0.28.0",
"pre-commit": "^1.2.2",
Expand Down
4 changes: 3 additions & 1 deletion src/files/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const promisify = require('promisify-es6')
const ConcatStream = require('concat-stream')
const once = require('once')
const isStream = require('is-stream')
const OtherBuffer = require('buffer').Buffer
const SendFilesStream = require('../utils/send-files-stream')

module.exports = (send) => {
Expand All @@ -23,7 +24,8 @@ module.exports = (send) => {

const ok = Buffer.isBuffer(_files) ||
isStream.readable(_files) ||
Array.isArray(_files)
Array.isArray(_files) ||
OtherBuffer.isBuffer(_files)

if (!ok) {
return callback(new Error('"files" must be a buffer, readable stream, or array of objects'))
Expand Down
Loading

0 comments on commit 066988f

Please sign in to comment.