Skip to content

TypeScriptPlayground/socket

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UNIX Socket

Run Linter Run Unit Tests

Use this library to open and connect to UNIX sockets, send requests and get responses similar to a fetch request. This library supports basic response chunk decoding.

Example

Connect to the docker.sock UNIX socket, send a request to /containers/json and log the response.

import { Socket } from '@typescriptplayground/socket';

const socket = new Socket('/var/run/docker.sock');

await socket.request('/containers/json')
  .then((res) => res.json())
  .then((json) => console.log(json));

About

Open and connect to UNIX sockets, send requests and get fetch like responses back.

Topics

Resources

License

Stars

Watchers

Forks