Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
auto-js-ipfs
Advanced tools
Automatically get some IPFS download/upload/pinning functionality based on your environment.
Automatically get some IPFS download/upload/pinning functionality based on your environment.
fetch()
API (e.g. for Agregore)opts => {daemonURL, web3StorageToken, estuaryToken, publicGatewayURL}
These options can be used to either detect what the best supported options are, or to create an instance of this API.
All options are optional, and by default just the local node/agregore support will be used.
daemonURL
is the URL of an IPFS daemon that should be used.
web3StorageToken
is the Authorization token for use in the web3.storage API.
web3StorageURL
is the web3.storage API server URL that should be used.
estuaryToken
is the Authorization token for use in the Estuary API.
estuaryURL
is the Estuary API server URL that should be used.
publicGatewayURL
is the public IPFS gateway to use for loading content without a local node.
readonly
is an option for whether there should be a fallback to "readonly" mode where only api.get
and api.getSize
will be supported. Enabled by default.
async detect(opts) => Promise<[{type, url?}]>
Detect what's supported in the current environment.
type
can be one of daemon
, fetch
, web3.storage
, estuary
url
is an optional value that will point to ipfs daemon URL being used or the public gateway being used, or the backend API URL to be used.
async choose(choice) => Promise<API>
Initialize the API based on the choice selected from detect()
async create(opts) => Promise<API>
Create an API instance by auto-detecting the "best" option available.
api.get(url, {start, end, format, signal}) => AsyncIterator<ArrayBuffer>
Get data from an ipfs://
URL, can optionally chose a start and end offset for loading data.
You can also optionally supply the format you want to load the data in. Valid formats are raw
for getting raw Blocks from IPFS, and car
for downloading a whole tree as a CAR (Content ARchive) file.
api.getSize(url, signal) => Promise<Number>
Get info about the size of a file at a URL.
api.uploadCar(carFileAsyncIterator, signal) => Promise<[url]>
Upload a CAR file. Returns an array of root ipfs://
URLs
api.uploadFile(fileAsyncIterator, fileName?, signal) => Promise<url>
Upload a file to the backend and get back a URL. Optionally specify a file name so that it will be wrapped in a folder.
api.clear(url, signal?) => Promise
Clear a URL that was previously downloaded and it's child nodes. This works by unpinning data when in kubo, removing it from the list in web3.storage, or deleting it from cache in Agregore.
FAQs
Automatically get some IPFS download/upload/pinning functionality based on your environment.
We found that auto-js-ipfs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.