Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
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 representation on top of a MerkleDAG)
This module contains the protobuf definition of the UnixFS data structure found at the root of all UnixFS DAGs.
The UnixFS spec can be found in the ipfs/specs repository
const data = new UnixFS({ type: '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.
const data = new UnixFS({ type: 'directory' })
const data = new UnixFS([options])
options
is an optional object argument that might include the following keys:
file
): The type of UnixFS entry. Can be:
raw
directory
file
metadata
symlink
hamt-sharded-directory
[]
): If this is a file
node that is made up of multiple blocks, blockSizes
is a list numbers that represent the size of the file chunks stored in each child node. It is used to calculate the total file size.0644
for files, 0755
for directories/hamt-sharded-directories) file modeDate
, { secs, nsecs }
, { Seconds, FractionalNanoseconds }
, [ secs, nsecs ]
): The modification time of this nodedata.addBlockSize(<size in bytes>)
data.removeBlockSize(<index>)
data.fileSize() // => size in bytes
const marshaled = data.marshal()
const unmarshaled = Unixfs.unmarshal(marshaled)
const dir = new Data({ type: 'directory' })
dir.isDirectory() // true
const file = new Data({ type: 'file' })
file.isDirectory() // false
If no modification time has been set, no mtime
property will be present on the Data
instance:
const file = new Data({ type: 'file' })
file.mtime // undefined
Object.prototype.hasOwnProperty.call(file, 'mtime') // false
const dir = new Data({ type: 'dir', mtime: new Date() })
dir.mtime // { secs: Number, nsecs: Number }
$ npm i ipfs-unixfs
<script>
tagLoading this module through a script tag will make its exports available as IpfsUnixfs
in the global namespace.
<script src="https://unpkg.com/ipfs-unixfs/dist/index.min.js"></script>
Licensed under either of
Contributions welcome! Please check out the issues.
Also see our contributing document for more information on how we work, and about contributing in general.
Please be aware that all interactions related to this repo are subject to the IPFS Code of Conduct.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
FAQs
JavaScript implementation of IPFS' unixfs (a Unix FileSystem representation on top of a MerkleDAG)
The npm package ipfs-unixfs receives a total of 86,709 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.