Sha256: b05ba732e167fcf9a4fd67ebb4a5c28cca4712a36376c0b0f2e4e1d37e7f18d2
Contents?: true
Size: 549 Bytes
Versions: 85
Compression:
Stored size: 549 Bytes
Contents
'use strict'; const fs = require('fs'); const shebangCommand = require('shebang-command'); function readShebang(command) { // Read the first 150 bytes from the file const size = 150; const buffer = Buffer.alloc(size); let fd; try { fd = fs.openSync(command, 'r'); fs.readSync(fd, buffer, 0, size, 0); fs.closeSync(fd); } catch (e) { /* Empty */ } // Attempt to extract shebang (null is returned if not a shebang) return shebangCommand(buffer.toString()); } module.exports = readShebang;
Version data entries
85 entries across 85 versions & 6 rubygems