Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
A client library for the IPFS API.
$ npm install --save ipfs-api
var ipfsAPI = require('ipfs-api')
// connect to ipfs daemon API server
var ipfs = ipfsAPI('localhost', '5001', {protocol: 'http'}) // leaving out the arguments will default to these values
// or connect with multiaddr
var ipfs = ipfsAPI('/ip4/127.0.0.1/tcp/5001')
// or using options
var ipfs = ipfsAPI({host: 'localhost', port: '5001', procotol: 'http'})
Same as in Node.js, you just have to browserify the code before serving it. See the browserify repo for how to do that.
<script>
tagYou can use npmcdn to get the latest built version, like this
<script src="https://npmcdn.com/ipfs-api/dist/ipfsapi.min.js"></script>
This will export the ipfsAPI
constructor on the window
object, such that:
var ipfs = window.ipfsAPI('localhost', '5001')
If you omit the host and port, the api will parse window.host
, and use this information. This also works, and can be useful if you want to write apps that can be run from multiple different gateways:
var ipfs = window.ipfsAPI()
If are using this module in a browser with something like browserify, then you will get an error saying that the origin is not allowed. This would be a CORS ("Cross Origin Resource Sharing") failure. The ipfs server rejects requests from unknown domains by default. You can whitelist the domain that you are calling from by changing your ipfs config like this:
$ ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin "[\"http://example.com\"]"
FAQs
A client library for the IPFS HTTP API
The npm package ipfs-api receives a total of 5,115 weekly downloads. As such, ipfs-api popularity was classified as popular.
We found that ipfs-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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 a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.