![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
The UUE module is able to perform uuencoding of a file (or Node.js Buffer) to a text message. This module is also able to find uuencoded files in text messages and decode them.
The module is named after a common .UUE
suffix for Fidonet echomail areas where uuencoded files are posted (sometimes the results of such encoding are also known as “UUE codes”).
The module is written in JavaScript and requires Node.js to run.
Latest packaged version: npm install uue
Latest githubbed version: npm install https://github.com/Mithgol/node-uue/tarball/master
The npm package does not contain the tests, they're published on GitHub only.
You may visit https://github.com/Mithgol/node-uue#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.)
When you require()
the installed module, you get an object that has the following methods:
Returns a string of UUE codes that represent the given source.
If encodeSource
is a string, it is interpreted as a path of some file, and that file is uuencoded.
If encodeSource
is a Node.js Buffer, the contents of that buffer become uuencoded.
**Note: ** if a file's name is given to the .encode
method, a synchronous reading of the given file is performed. If you need an asynchronous reading, perform it yourself and give the resulting Buffer to the .encode
method.
The optional encodeOptions
parameter is an object with the following optional properties:
mode
— read/write/execute permissions for the file. If this property is omitted, three last octal digits of the mode
property of the given file's fs.Stats
object are used (or '644'
if a Buffer is given in encodeSource
instead of a file). The mode
property may be given as a string (of octal digits) or as a number (for example, '666'
and 438
are equivalent).
filename
— a file's name to be given in UUE codes. (For example, if encodeOptions
is {mode:'664', filename:'filename.ext'}
, then the first line of UUE codes is begin 664 filename.ext
.) If this property is omitted, then path.basename(encodeSource)
is used (or 'buffer.bin'
if a Buffer is given in encodeSource
instead of a file).
eol
— end-of-line character(s). If this property is omitted, \n
(\x0A
) is used (as in Web or UN*X applications). You may want to set encodeOptions.eol
equal to os.EOL
on other systems. The value of encodeOptions.eol
is used only as a separator between lines of UUE codes, but neither in the beginning nor at the end of the returned string.
Example (uuencoding the word 'Cat'
, as in Wikipedia):
Using the given filename
, finds the uuencoded file in the given text
, decodes the file and returns it as a Node.js Buffer.
Lines in the given text
are expected to be separated by '\n'
(\x0A
).
Invalid UUE codes are ignored.
Any UUE codes of any file that has a different filename (not the given filename
) are ignored. (If text
contains several uuencoded files, it is not necessary for filename
to go first.)
If several uuencoded files have the same filename
(case-sensitive), only the first is returned (its other namesakes are ignored).
If the file cannot be found in the given text
, null
is returned.
Finds all uuencoded files in the given text
, decodes them and returns as an array.
Entries in the returned array are objects with the following properties:
name
— the file's name (as it appeared in UUE codes);
data
— a Node.js Buffer containing the file's decoded contents.
Lines in the given text
are expected to be separated by '\n'
(\x0A
).
Invalid UUE codes are ignored.
The returned array contains files in order of their appearance in the given text
. If several uuencoded files have the same name
(case-sensitive), only the first file is returned (its other namesakes are ignored).
If the given text
does not seem to contain any uuencoded files, an empty array ([]
) is returned.
The module does not lock any files and does not create any “lock files” (flag files, semaphore files). The module's caller should control the access to the file that is being encoded.
The tests are not included in the npm package of the module (to keep it small). Use the version from GitHub.
It is necessary to install Mocha and JSHint for testing.
You may install Mocha globally (npm install mocha -g
) or locally (npm install mocha
in the directory of the UUE module).
You may install JSHint globally (npm install jshint -g
) or locally (npm install jshint
in the directory of the UUE module).
After that you may run npm test
(in the directory of the UUE module).
MIT license (see the LICENSE
file).
FAQs
UUE decoder and encoder for Node.js
The npm package uue receives a total of 80,035 weekly downloads. As such, uue popularity was classified as popular.
We found that uue demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.