
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
ipfs-unixfs
Advanced tools
JavaScript implementation of IPFS' unixfs (a Unix FileSystem representation on top of a MerkleDAG)
JavaScript implementation of IPFS' unixfs (a Unix FileSystem files representation on top of a MerkleDAG)
The unixfs spec can be found inside the ipfs/specs repository
> npm i ipfs-unixfs
var Unixfs = require('ipfs-unixfs')
The code published to npm that gets loaded on require is in fact a ES5 transpiled version with the right shims added. This means that you can require it and use with your favourite bundler without having to adjust asset management process.
var Unixfs = require('ipfs-unixfs')
Loading this module through a script tag will make the Unixfs
obj available in the global namespace.
<script src="https://npmcdn.com/ipfs-unixfs/dist/index.min.js"></script>
<!-- OR -->
<script src="https://npmcdn.com/ipfs-unixfs/dist/index.js"></script>
var data = new Unixfs('file')
data.addBlockSize(256) // add the size of each block
data.addBlockSize(256)
// ...
Creating a directory that contains several files is achieve by creating a unixfs element that identifies a MerkleDAG node as a directory. The links of that MerkleDAG node are the files that are contained in this directory.
var data = new Unixfs('directory')
message Data {
enum DataType {
Raw = 0;
Directory = 1;
File = 2;
Metadata = 3;
Symlink = 4;
}
required DataType Type = 1;
optional bytes Data = 2;
optional uint64 filesize = 3;
repeated uint64 blocksizes = 4;
}
message Metadata {
optional string MimeType = 1;
}
var data = new UnixFS(<type>, [<content>])
Type can be: ['raw', 'directory', 'file', 'metadata', 'symlink']
data.addBlockSize(<size in bytes>)
data.removeBlockSize(<index>)
data.fileSize() // => size in bytes
var marshaled = data.marshal()
var unmarshaled = Unixfs.unmarshal(marshaled)
Feel free to join in. All welcome. Open an issue!
This repository falls under the IPFS Code of Conduct.
FAQs
JavaScript implementation of IPFS' unixfs (a Unix FileSystem representation on top of a MerkleDAG)
The npm package ipfs-unixfs receives a total of 173,604 weekly downloads. As such, ipfs-unixfs popularity was classified as popular.
We found that ipfs-unixfs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.