1.0.8 • Published 9 months ago

xpipe v1.0.8

Weekly downloads
471,964
License
MIT
Repository
github
Last release
9 months ago

xpipe^1

Use cross-platform IPC paths in Node.js.

Background

In Node.js - instead of using TCP - you also can take IPC^2 to communicate to services like

  • web servers (NGINX, Caddy)
  • databases (redis, PostgreSQL, MongoDB)
  • etc.

or to interconnect Node.js apps, Electron frontends/backends and so on.

This can lead to large speed gains.

On unixoid operating systems - e.g. Linux and OS X - we use Unix domain sockets that are referred by file descriptors.

Windows has named pipes for it, living in the root directory of the NPFS^3, mounted under the special path \\.\pipe\.

To mitigate these differences and to to support writing portable code, xpipe was born...

Installation

npm install xpipe

Usage

// CommonJS (CJS) require
const xpipe = require('xpipe');
// ECMAScript Modules (ESM) import
import xpipe from 'xpipe';

xpipe.prefix

let prefix = xpipe.prefix;
console.log(`prefix:  ${prefix}`);

//   [empty string] on Linux and macOS
//   "//./pipe/" on Windows

xpipe.eq

let ipcPath = xpipe.eq('/tmp/my.sock');
console.log(`ipcPath: ${ipcPath}`);

//   Returns a cross-platform IPC path:
//   "/tmp/my.sock" on Linux and OS X
//   "//./pipe/tmp/my.sock" on Windows

When did Windows start accepting forward slash as a path separator?

Every Windows API/kernel ever has accepted "/" as a path separator. So has every version of MS-DOS beginning with DOS 2.0 (the first version to support subdirectories).

It's only been in command lines that "/" was not allowed when it had already been used as a switch delimiter in MS-DOS 1.0 (introduced by IBM).

This behaviour could be bypassed (at least on modern Windows systems) by including the path in double quotation marks:

  • cd c:/Windows and cd /Windows work^4
  • dir ./ /B fails but dir "./" /B works

Further articles:

react-native-bluetooth2killi8n-react-native-fast-imagern-send-smsreact-native-template-rfbaseairscanairscan-examplereact-native-esc-pos-sahaab@borisovart/atol-kkt-moduledeneme323112@ntt_app/react-native-custom-notificationreact-native-covid-sdkreact-native-thanh-toast-library@thanhnguyen14797/react-native-thanh-toast-libraryreact-native-printer-brothersrn-pdf-reader-offlinern-0.45-fork-oreo@everything-registry/sub-chunk-3188testnpm_lmn@corelmax/react-native-my2c2p-sdk@caiwenshu/metro-bundlerjnf-accesscontrol-rnttltrc-react-native@apardellass/react-native-audio-stream@askel4dd/metro@axsy-dev/metro-bundlerupstream-proxy@felipesimmi/react-native-datalogic-module@hawkingnetwork/react-native-tab-view@hbglobal/react-native-actions-shortcuts@geeky-apo/react-native-advanced-clipboard@grandrounds/react-native@infinitebrahmanuniverse/nolb-xp@lilithmod/unborn-ipc@navabi/react-native-ssl-pinning@nocobase/server@meerasolution/react-native-ms-upi-payment@jkottnauer/react-native@iyansr/react-native-image-viewing@kohout.jakub/react-native@ko-developerhong/react-native-multiple-image-picker@hemith/react-native-tnk@saad27/react-native-bottom-tab-tour@phong95/react-native-multiple-image-pickermy-react-native-versionms-react-nativemetro-medmetro-pnpmmetro-eslintmetro-test-buildmetro-bundlernative-apple-loginnative-kakao-loginnative-google-loginonemonnpm_qwertynpm_one_12_34_1_npm_one_1_2_3npm_one_2_2payutestingreact-native-dsphoto-modulereact-native-create-video-thumbnailreact-native-cplusreact-native-modal-progress-barreact-native-is7react-native-hlf-wrapperreact-native-flyyreact-native-myrenzbox-ipcsdk-libraryreac-native-arun-ramya-testrn-adyen-dropinrn-tm-notifyrn-session-multiplier-demorocket-bundlerreact-native-arun-ramya-testreact-native-arunjeyam1987react-native-arunmeena1987react-native-arunramya151react-native-brother-projectreact-native-bubble-chartreact-native-badge-controlreact-native-biometric-authenticatereact-native-android-advertising-idreact-native-my-first-try-arun-ramyareact-native-ok-sdkreact-native-payu-payment-testingreact-native-kakao-mapsreact-native-jsi-device-inforeact-native-contact-listreact-native-sunmi-printer-hkreact-native-version-managerreact-native-testwebreact-native-transtracker-libraryreact-native-test-module-hhhreact-native-vnpay-merchantreact-native-sayhello-modulereact-native-sample-android-toast-version10react-native-plugpag-wrapperreact-native-plusreact-native-pulsator-nativereact-native-responsive-sizereact-native-ytximkit
1.0.8

9 months ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago