New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

arlib

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arlib

Andras' Utility Functions

  • 0.0.5
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

arlib

Andras' Library of Handy Utilities

This is a placeholder for some of the code I've been working on that I want easy access to. Feel free to browse and use!

Contents

The components are all available with require('arlib'), or each component is loadable separately with eg require('arlib/tempnam').

tempnam

php tempnam equivalent, creates a filename that does not exist on the system. Like php, it also creates the file to prevent the name from being reused.

    var tempnam = require('arlib/tempnam');
    var filename = tempnam("/usr/tmp", "filename-prefix-");
    // /usr/tmp/filename-prefix-a7259b

getopt

traditional unix command option extractor, returns an object with the options set as properties.

    var getopt = require('arlib/getopt').getopt;
    var options = getopt(process.argv, "f:h");
    // {f: 'filename', h: true}
    var options = getopt(process.argv, "(-file):(-help)");
    // {file: 'filename', help: true}

Fgets

synchronous line-at-a-time stream reader. Returns the next buffered line or the empty string "" when the buffer is empty.

    var fs = require('fs');
    var Fgets = require('arlib').Fgets;
    var fp = new Fgets(fs.createReadStream(filename, 'r'));
    // line = fp.fgets();
FileReader

fast file reader to fee data to fgets, 30% faster than read streams.

    var FileReader = require('arlib').FileReader;
    var fp = new Fgets(new FileReader(filename));
    // line = fp.fgets();

Keywords

FAQs

Package last updated on 14 Oct 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc