https://github.com/131/tar-serve-http
expose a tar contents as an http server
https://github.com/131/tar-serve-http
Last synced: about 1 year ago
JSON representation
expose a tar contents as an http server
- Host: GitHub
- URL: https://github.com/131/tar-serve-http
- Owner: 131
- License: mit
- Created: 2019-08-09T20:26:43.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2021-12-09T15:22:55.000Z (over 4 years ago)
- Last Synced: 2025-04-21T23:36:21.102Z (about 1 year ago)
- Language: JavaScript
- Size: 128 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/131/tar-serve-http/actions/workflows/test.yml)
[](https://coveralls.io/github/131/tar-serve-http?branch=master)
[](https://www.npmjs.com/package/tar-serve-http)
[](http://opensource.org/licenses/MIT)
[](https://www.npmjs.com/package/eslint-plugin-ivs)
# Motivation
[tar-serve-http](https://github.com/131/tar-serve-http) exposes a tar archive contents as an http middleware.
# API/usage
```
const http = require('http');
const mountTar = require('tar-serve-http');
var server = http.createServer(mountTar("/some/file.tar"));
server.listen(0, function() {
let port = this.address().port;
console.log("tar contents is now accessible on http://localhost:%d/", port);
server.close(); //close server and release tar
});
```
# Credits / thanks
* [131, author](https://github.com/131)
* [mafintosh tar-stream](https://github.com/mafintosh/tar-stream)