1.0.7 • Published 2 days ago

xpipe v1.0.7

Weekly downloads
471,964
License
MIT
Repository
github
Last release
2 days 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-3188@geeky-apo/react-native-advanced-clipboard@grandrounds/react-native@hemith/react-native-tnkjumbledrocket-bundlerrn-tm-notifyrn-adyen-dropinrn-session-multiplier-demotrc-react-nativesharingcomponent2testnpm_lmnupstream-proxy@ko-developerhong/react-native-multiple-image-picker@kohout.jakub/react-native@lilithmod/unborn-ipc@infinitebrahmanuniverse/nolb-xp@meerasolution/react-native-ms-upi-payment@navabi/react-native-ssl-pinning@nocobase/serveriftide-cli@saad27/react-native-bottom-tab-tour@hawkingnetwork/react-native-tab-view@hbglobal/react-native-actions-shortcuts@iyansr/react-native-image-viewing@jkottnauer/react-nativehaul@phong95/react-native-multiple-image-picker@felipesimmi/react-native-datalogic-module@taingo97/react-native-expo-key-rsa-kt@taingo97/react-native-expo-rsa@taingo97/react-native-rsa@taingo97/react-native-telpo-printer@thanhpcc96/bundler-thanhpccnative-apple-loginnative-kakao-login@askel4dd/metro@caiwenshu/metro-bundler@axsy-dev/metro-bundler@apardellass/react-native-audio-streammy-react-native-version@yplabs-ltd/react-native-detector@vjpr/metrolrn_metronpm_qwertynpm_one_1_2_3npm_one_2_2npm_one_12_34_1_ms-react-native@wecraftapps/react-native-use-keyboard@wellbye/metroadyen-rnnode-proxy-balancernative-google-loginbirken-react-native-community-image-editor@corelmax/react-native-my2c2p-sdkmage@upacyxou/react-native-draggable-flatlist@valifysolutions/react-native-vidvliveness@sultandelux/react-native-sms-user-consent@tugraph/openpiece-server@tsyeyuanfeng/metro-bundler@tasumaniadiabori/react-native-draggable-flatlistmetro-bundlermetro-eslintmetro-test-buildmetro-medmetro-pnpmpayutestingcrocketonemonreact-native-android-advertising-idreact-native-arun-ramya-testreact-native-arunjeyam1987react-native-arunmeena1987react-native-arunramya151prnprn-metro-bundlerreact-native-myrenzbox-ipcsdk-libraryreact-native-ok-sdkreact-native-dsphoto-modulereact-native-jsi-device-inforeact-native-modal-progress-barreact-native-payu-payment-testing
1.0.7

2 days ago

1.0.6

2 days ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago