namePipe

Creating a Named Pipe

  • At the other functions, you’ll normally see that they all accomodate either a numerical port number or a string descriped as a pipe:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17

    export function onError(error) {
    if (error.syscall !== 'listen') {
    throw error;
    }
    const bind = typeof port === 'string'
    ? 'Pipe ' + port
    : 'Port ' + port;
    switch (error.code) {
    case 'EACCES':
    console.error(`${bind} requires elevated privileges`);
    process.exit(1);
    break;
    default;
    throw error;
    }
    }