
Security News
Vite Releases Technical Preview of Rolldown-Vite, a Rust-Based Bundler
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
ipfs-repo
Advanced tools
Implementation of the IPFS repo spec (https://github.com/ipfs/specs/tree/master/repo) in JavaScript
This is the implementation of the IPFS repo spec in JavaScript.
β β β β β β β β β β β β β β β β β β
interface defined by Repo Spec
βββββββββββββββββββββββββββββββββββ€
β β ββββββββββββββββββββββββ
β β β abstract-blob-store β
β IPFS REPO βββββββββββββββββββββββββββββββββββΆβ interface β
β β ββββββββββββββββββββββββ€
β β β locks β
βββββββββββββββββββββββββββββββββββ ββββββββββββββββββββββββ
β
ββββββββββββ΄βββββ¬ββββββββββββββββ¬ββββββββββββββββ¬ββββββββββββββββ¬ββββββββββββββββ
βΌ βΌ βΌ βΌ βΌ βΌ
βββββββββββββ βββββββββββββ βββββββββββββ βββββββββββββ βββββββββββββ βββββββββββββ
β abstract β β abstract β β abstract β β abstract β β abstract β β abstract β
β -blog β β -blog β β -blog β β -blog β β -blog β β -blog β
β -store β β -store β β -store β β -store β β -store β β -store β
β interface β β interface β β interface β β interface β β interface β β interface β
βββββββββββββ€ βββββββββββββ€ βββββββββββββ€ βββββββββββββ€ βββββββββββββ€ βββββββββββββ€
β β β β β β β β β β β β
β keys β β config β β datastore β β datastore β β logs β β version β
β β β β β β β -legacy β β β β β
βββββββββββββ βββββββββββββ βββββββββββββ βββββββββββββ βββββββββββββ βββββββββββββ
IPFS repo exposes a well defined interface by the Repo Spec. Each of the individual repos has an interface defined by abstract-blob-store, this enables us to make IPFS repo portable (running on Node.js vs the browser) and accept different types of storage mechanisms for each repo (fs, levelDB, etc).
Standard Node.js way.
$ npm i ipfs-repo
Constructor, accepts a path and options:
var IPFSRepo = require('js-ipfs-repo')
var repo = new IPFSRepo('/Users/someone/.ipfs', {
stores: {
keys: <something that implements abstract-blob-store>,
config: <something that implements abstract-blob-store>,
datastore: <something that implements abstract-blob-store>,
logs: <something that implements abstract-blob-store>,
locks: <something that implements abstract-blob-store>,
version: <something that implements abstract-blob-store>
}})
You can check if the repo you are going to access already exists on the path you passed to the constructor by:
repo.exists(function (err, exists) {
// exists is a boolean value
})
If the repo doesn't exist yet, you can start it by executing the init
cuntion
repo.init(opts, function (err) {})
Read/Write the version number of that repository.
repo.version.get(function (err, version) {
console.log(err, num) // => 2
})
repo.version.set(3, function (err) {
console.log(err)
})
Read/Write the JSON configuration for that repository.
repo.config.read(function (err, json) {
console.log(err, json)
})
repo.config.write({foo: 'bar'}, function (err) {
console.log(err)
})
Read/Write keys inside the repo. This feature will be expanded once IPRS and KeyChain are finalized and implemented on go-ipfs.
repo.keys.get(function (err, privKey) {})
Store data on the block store.
repo.datastore.read('12200007d4e3a319cd8c7c9979280e150fc5dbaae1ce54e790f84ae5fd3c3c1a0475', function (err, buff) {
console.log(err)
})
repo.datastore.write(buff, function (err, buffer) {
console.log(buff.toString('utf-8'), err)
})
WIP
repo.datastoreLegacy
repo.datastoreLegacy
Note: You shouldn't need to use this. It is used internally
Read/Write the repo.lock
file.
repo.locks.lock(function (err) {})
repo.locks.unlock(function (err) {})
No longer supported, see https://github.com/ipfs/js-ipfs-repo/issues/8
There is some ways you can make this module better:
FAQs
IPFS Repo implementation
The npm package ipfs-repo receives a total of 3,025 weekly downloads. As such, ipfs-repo popularity was classified as popular.
We found that ipfs-repo demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.Β It has 3 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.
Security News
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
Research
Security News
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.