file

command
v0.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 26, 2020 License: MIT Imports: 4 Imported by: 0

README

file

Here's something trippy: a service that responds with its own source code.

$ flatend
2020/06/17 02:36:30 Listening for Flatend nodes on '127.0.0.1:9000'.
2020/06/17 02:36:30 Listening for HTTP requests on '[::]:3000'.
2020/06/17 02:36:41 <anon> has connected to you. Services: [file]

$ node index.js
Successfully dialed 127.0.0.1:9000. Services: []

$ http://localhost:3000/
const {Node} = require("flatend");
const fs = require("fs");

const main = async () => {
    const node = new Node();
    node.register('file', ctx => fs.createReadStream("index.js").pipe(ctx));
    await node.dial("127.0.0.1:9000");
}

main().catch(err => console.error(err));
addr = "127.0.0.1:9000"

[[http]]
addr = ":3000"

[[http.routes]]
path = "GET /"
service = "file"
const { Node } = require("flatend");
const fs = require("fs");

const main = async () => {
  const node = new Node();
  node.register("file", (ctx) => fs.createReadStream("index.js").pipe(ctx));
  await node.dial("127.0.0.1:9000");
};

main().catch((err) => console.error(err));

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy