Skip to content

Latest commit

 

History

History
21 lines (14 loc) · 880 Bytes

File metadata and controls

21 lines (14 loc) · 880 Bytes

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));