find-msgid-in-file
v0.1.0
Published
Finds the MSGID of a Fidonet message in the file containing that message.
Downloads
3
Readme
This module (find-msgid-in-file
) finds the MSGID of a Fidonet message in the file containing that message.
Such a file (containing a Fidonet message) is typically generated by a Fidonet message editor when it calls an external utility. (For example, GoldED+ or GoldED-NSF would generate such a file if the corresponding GoldED's ExternUtil
configuration line contains the @file
parameter.)
This module is written in JavaScript and requires Node.js to run. It uses some ECMAScript 2015 features, and thus a relatively recent Node.js is required. This module is tested against the latest stable version of Node.js.
Installing the MSGID finder
Latest packaged version:
npm install find-msgid-in-file
Latest githubbed version:
npm install https://github.com/Mithgol/node-find-msgid-in-file/tarball/master
You may visit https://github.com/Mithgol/node-find-msgid-in-file#readme occasionally to read the latest README
because the package's version is not planned to grow after changes when they happen in README
only. (And npm publish --force
is forbidden nowadays.)
Using the MSGID finder
When you require the installed module, you get a function that finds the MSGID of a Fidonet message (in the file containing that message) asynchronously.
That function has two parameters. The first parameter must be the path to the file containing a Fidonet message. The second parameter is a callback function with a signature (error, MSGID)
that asynchronously receives the MSGID. One of the following happens:
callback(someError)
is called if an error occurs infs.readFile
of the given filecallback(null, null)
is called if the file does not seem to contain a MSGID kludgecallback(null, MSGID)
is called if the MSGID is found
The MSGID kludge in the given file is expected to adhere to the FTS-0009 standard: the kludge appears on a separate line of the file, starts with '\x01MSGID:'
, then one or several optional whitespaces, then the MSGID value, then the end of that line. Only that MSGID value (as a JavaScript string) is passed to the callback (i.e. the standard beginning of that line is removed from the string before the call).
Testing the MSGID finder
It is necessary to install JSHint for testing.
- You may install JSHint globally (
npm install jshint -g
) or locally (npm install jshint
in the directory of the MSGID finder).
After that you may run npm test
(in the directory of the MSGID finder). Only the JS code errors are caught; the code's behaviour is not tested.
License
MIT license (see the LICENSE
file).