Abstract |
---|
The iolib JavaScript library has functions for handling line-by-line text I/O, block-oriented binary I/O, and filesystem operations. |
Reading and writing text files using line-oriented functions is a common need. Handling block transfers of binary data is necessary for packed data formats.
Performing basic filesystem operations complements these two.
The TextReader
class has a UTF-8 aware getline
method for parsing a text file
one line at a time.
The TextWriter
class has putline
and puts
methods to serialize to a text file.
The lower level BinaryReader
reads a block of 8192 bytes, advancing the buffer
pointer with each read.
The BinaryWriter
class has methods for writing Strings, Buffers, 4-bytes,
2-bytes, and 1-byte .
The Pfile
class has methods for checking if a file exists; if it's a directory
or a symlink; if it's readable, writable, executable; and for assembling and
accessing parts of a file's path, basename, and extension.
The iolib library may be installed directly from github or via NPM.
[user@host]# npm install iolib
Sample usage of the libary in a node.js project:
import {TextReader} from 'iolib';
import {TextWriter} from 'iolib';
import {BinaryReader} from 'iolib';
import {BinaryWriter} from 'iolib';
import {Pfile} from 'iolib';
This library depends on softlib , which should be installed side-by-side.
ES modules | true |
Common JS | false |
Browser | none |
node.js | API |
Documentation | Read Write Hub | |
Source code | github | |
Package installation | npm |
The iolib library is licensed under the MIT License.
MIT License
Copyright © 2022 Read Write Tools.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.