Coder Social home page Coder Social logo

fixedline's Introduction

Creating and reading fixed size lines.

Usage:

var Parser = require('fixedline').Parser;
var simple = new Parser({
	date: {
		size: 5,
		type: String
	},
	counter: {
		size: 5,
		type: Number
	},
	bool: {
		size: 5,
		type: Boolean
	}
});

var buffer = sample.encode(['12:06:34 2014/0/30', '012345', 'true']);
//return Buffer of size 29 chars, no matter if there are specified any data or data are to long

//if true, return object {date: ..., counter: ..., bool: ...} else [..., ..., ...]
var toObj = true;

sample.decode(buffer, toObj)

Parser.encode( [ params ] )

return Buffer

Parser.decode( buffer, toObj )

return Object or Array with data

Parser.getLine( fd/path, lineNum, toObj )

as above but from file with specified line

Parser.lineBytes( fd/path, lineNum )

return Object {fd: fileDescription, start: Number, end: Number} where start and end is range in file

Parser.getCell( fd/path, lineNum, cellNum/name )

as above but of cell

Parser.cellBytes( fd/path, lineNum, cellNum )

like .getLine but only one cell

//TODO
.getLines( fd/path, startLine, endLine, toObj )
add array support

fixedline's People

Contributors

wszerad avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.