New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ipfs-unixfs-importer

Package Overview
Dependencies
Maintainers
1
Versions
136
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ipfs-unixfs-importer - npm Package Compare versions

Comparing version 2.0.2-rc.2 to 2.0.2-rc.3

src/utils/utf8-encoder.js

17

package.json
{
"name": "ipfs-unixfs-importer",
"version": "2.0.2-rc.2+5ffa2b3",
"version": "2.0.2-rc.3+db60a42",
"description": "JavaScript implementation of the UnixFs importer used by IPFS",

@@ -38,3 +38,4 @@ "leadMaintainer": "Alex Potsides <alex.potsides@protocol.ai>",

"devDependencies": {
"aegir": "^22.0.0",
"aegir": "^25.0.0",
"buffer": "^5.6.0",
"chai": "^4.2.0",

@@ -44,5 +45,5 @@ "cids": "^0.8.0",

"dirty-chai": "^2.0.1",
"ipfs-unixfs-exporter": "^2.0.2-rc.2+5ffa2b3",
"ipfs-unixfs-exporter": "^2.0.2-rc.3+db60a42",
"ipld": "^0.26.1",
"ipld-in-memory": "^4.0.0",
"ipld-in-memory": "^5.0.0",
"it-buffer-stream": "^1.0.2",

@@ -57,6 +58,6 @@ "it-last": "^1.0.1",

"bl": "^4.0.0",
"buffer": "^5.6.0",
"err-code": "^2.0.0",
"hamt-sharding": "^1.0.0",
"ipfs-unixfs": "^1.0.2",
"ipfs-unixfs": "^1.0.3-rc.3+db60a42",
"ipfs-utils": "^2.3.1",
"ipld-dag-pb": "^0.19.0",

@@ -68,6 +69,6 @@ "it-all": "^1.0.1",

"merge-options": "^2.0.0",
"multihashing-async": "^0.8.0",
"multihashing-async": "^1.0.0",
"rabin-wasm": "^0.1.1"
},
"gitHead": "5ffa2b38ef28f1a29ee2deb0792b904415bc10ee"
"gitHead": "db60a4232e600e73227e6ab8964be083eada389a"
}
'use strict'
const errCode = require('err-code')
const { Buffer } = require('buffer')
const utf8Encoder = require('../utils/utf8-encoder')

@@ -14,5 +14,5 @@ // make sure the content only emits buffer-a-likes

if (typeof content === 'string' || content instanceof String) {
yield Buffer.from(content, 'utf8')
yield utf8Encoder.encode(content)
} else if (Array.isArray(content)) {
yield Buffer.from(content)
yield Uint8Array.from(content)
} else {

@@ -19,0 +19,0 @@ yield content

@@ -7,3 +7,2 @@ 'use strict'

} = require('ipld-dag-pb')
const { Buffer } = require('buffer')
const UnixFS = require('ipfs-unixfs')

@@ -15,5 +14,7 @@ const multihashing = require('multihashing-async')

const mergeOptions = require('merge-options').bind({ ignoreUndefined: true })
const utf8Encoder = require('./utils/utf8-encoder')
const hashFn = async function (value) {
const hash = await multihashing(Buffer.from(value, 'utf8'), 'murmur3-128')
const buf = utf8Encoder.encode(value)
const hash = await multihashing(buf, 'murmur3-128')

@@ -26,3 +27,3 @@ // Multihashing inserts preamble of 2 bytes. Remove it.

const length = justHash.length
const result = Buffer.alloc(length)
const result = new Uint8Array(length)
// TODO: invert buffer because that's how Go impl does it

@@ -148,3 +149,3 @@ for (let i = 0; i < length; i++) {

// reverse the bit field before storing it
const data = Buffer.from(children.bitField().reverse())
const data = Uint8Array.from(children.bitField().reverse())
const dir = new UnixFS({

@@ -151,0 +152,0 @@ type: 'hamt-sharded-directory',

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc