Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ipfs-node-server-static

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ipfs-node-server-static

Static file server middleware for ipfs

  • 1.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

IPFS Middleware

Server ipfs objects from /ipfs/ on a server through the API interface.

By default only objects are served and actual api access is disabled. See other options at the end to enable the API.

If you wish to simply serve static files through the ipfs gateway I guess you guys proxy-middleware

Install

npm install ipfs-node-server-static

Currently only allows no mount point for express

Express

var ipfs_static = require('./')('localhost', 5001)

var express = require('express')
var app = express()

app.use(ipfs_static)

app.get('/', function (req, res) {
  res.send('Hello World!')
})

var server = app.listen(3000, function () {

  var host = server.address().address
  var port = server.address().port

  console.log('Example app listening at http://%s:%s', host, port)

})

Stock Http

var ipfs_static = require('./')('localhost', 5001)

var http = require('http')

var server = http.Server(function (req, res) {
	var send404 = (function() {
		return function send404() {
			res.writeHead(404)
			res.end()
		}
	})()

	ipfs_static(req, res, send404) 

}).listen(3000, function () { 
  var host = server.address().address
  var port = server.address().port

  console.log('Example app listening at http://%s:%s', host, port)
})

Other options

API By default ipfs-node-server-static uses the api to fullfil requests. You can enable the pass of /api/ as well by passing true to the api option.

var ipfs_static = require('./')('localhost', 5001, {api: true})

Keywords

FAQs

Package last updated on 27 Feb 2015

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc