open-index/open-npm huggingface dataset:
npm package: @myrotvorets/buffer-stream
Description: Converts a Buffer into a Readable Stream
Author: Myrotvorets
Latest version: 1.4.1

# buffer-stream

[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=myrotvorets_buffer-stream&metric=alert_status)](https://sonarcloud.io/dashboard?id=myrotvorets_buffer-stream)
[![Build and Test](https://github.com/myrotvorets/buffer-stream/actions/workflows/build.yml/badge.svg)](https://github.com/myrotvorets/buffer-stream/actions/workflows/build.yml)

Converts a Buffer into a Readable Stream.

Since version 1.1.0, it provides a helper to read the entire stream into a Buffer.

Since version 1.3.0, it provides a writable stream that stores the result in a buffer.

## Usage

```js
import { BufferStream, WritableBufferStream, streamToBuffer } from '@myrotvorets/buffer-stream';

// BufferStream
const buf = Buffer.from('123');
const stream = new BufferStream(buf);

// streamToBuffer
streamToBuffer(stream).then((buffer) => { /* ... */ })

// WritableBufferStream
const stream = new WritableBufferStream();
stream.write('something', (err) => {
    if (!err) {
        console.log(stream.toString());

        stream.clear(); // Clear the internal buffer
    }
});

await stream.writeP('something else');
```

See the [`test`](test) directory for usage examples.
npm package: @myrotvorets/clean-up-after-multer
Description: Express.js middleware to clean up uploaded files after multer
Author: Myrotvorets
Latest version: 1.1.12

# clean-up-after-multer

[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=myrotvorets_clean-up-after-multer&metric=alert_status)](https://sonarcloud.io/dashboard?id=myrotvorets_clean-up-after-multer)
[![Build and Test](https://github.com/myrotvorets/clean-up-after-multer/actions/workflows/build.yml/badge.svg)](https://github.com/myrotvorets/clean-up-after-multer/actions/workflows/build.yml)

Express.js middleware to clean up uploaded files after multer

# Usage

```typescript
import express from 'express';
import { cleanUploadedFilesMiddleware } from '@myrotvorets/clean-up-after-multer'


const app = express();
app.use(/* your middlewares here */);
app.use(cleanUploadedFilesMiddleware());
```

Make sure to call `next()` from your middlewares.

`cleanUploadedFilesMiddleware()` accepts an argument of type `(path: string) => Promise<unknown>` to specify the custom `unlink()` function (in case you want to log unlink failures etc).
npm package: @myrotvorets/ejs-compiled-loader
Description: EJS webpack loader (without frontend dependencies)
Latest version: 4.0.0

# ejs-compiled-loader for webpack

EJS loader for [webpack](https://webpack.js.org/). Uses [ejs](https://github.com/mde/ejs) function to compile templates.

This is the fork of the now abandoned [bazilio91/ejs-compiled-loader](https://github.com/bazilio91/ejs-compiled-loader) with updated dependencies, fixed vulnerabilities, and updated code base.

The main differences are:
* uses `ejs@3.x` instead of 2.x because `ejs` up to 3.1.9 has multiple vulnerabilities ([CVE-2022-29078](https://github.com/advisories/GHSA-phwq-j96m-2c2q), [CVE-2024-33883](https://github.com/advisories/GHSA-ghr5-ch3p-vcr6));
* uses `html-minifier-terser` instead of the abandoned `html-minifier` (which is affected by a [ReDoS vulnerability](https://github.com/advisories/GHSA-pfq8-rq6v-vf5m)). Some options of `html-minifier-terser` differs from those of `html-minifier`;
* does not suppoprt Webpack 4.x.

## Installation

```sh
npm install -D @myrotvorets/ejs-compiled-loader
```

## Usage

[Documentation: Using loaders](https://webpack.js.org/concepts/loaders/#using-loaders)

``` javascript
const template = require("ejs-compiled-loader!./file.ejs");
// => returns the template function compiled with ejs templating engine.

// And then use it somewhere in your code
template(data) // Pass object with data
```

## Options

The following options are supported:
* `beautify`: enable or disable terser beautify of the template AST;
* `compileDebug`: see the EJS [`compileDebug` option](https://ejs.co/#docs);
* `htmlmin`: whether to enable HTML minification;
* `htmlminOptions`: [options passed to `html-minifier-terser`](http://perfectionkills.com/experimenting-with-html-minifier/#options);
* `minimize`: whether to minimize the resulting JS code with [Terser](https://terser.org/);
* `terserOptions`: [options passed to `terser`](https://terser.org/docs/options/);
* [options supported by EJS](https://ejs.co/#docs).

## License

MIT (http://www.opensource.org/licenses/mit-license.php)
npm package: @myrotvorets/envalidators
Description: Collection of validators for envalid
Author: Myrotvorets
Latest version: 2.1.3

# envalidators

[![Build and Test](https://github.com/myrotvorets/envalidators/actions/workflows/build.yml/badge.svg)](https://github.com/myrotvorets/envalidators/actions/workflows/build.yml)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=myrotvorets_envalidators&metric=alert_status)](https://sonarcloud.io/dashboard?id=myrotvorets_envalidators)

Collection of validators for envalid
npm package: @myrotvorets/express-acceptsjson-middleware
Description: Middleware to check whether the client is willing to accept JSON response
Author: Myrotvorets
Latest version: 2.0.3

# express-acceptsjson-middleware

Express.js middleware to check whether the client is willing to accept JSON response.

## Usage

```typescript
import { type Request, type Response, Router } from 'express';
import { acceptsJsonMiddleware } from '@myrotvorets/express-acceptsjson-middleware';

const router = Router();
router.get('/some-path', acceptsJsonMiddleware, otherHandler);
```

## What it Does

The middleware checks the presence of `Accept` HTTP header, and if it is there, it checks whther the client is willing to accept JSON. If not, it returns 406 Not Acceptable error (with JSON payload :-) ).

It is considered that the client is willing to accept JSON if at least one of the following conditions is true:
  * there is no `Accept` header;
  * `Accept` header contains `*/*` or `*/json`;
  * `Accept` header contains `application/*` or `application/json`.

The actual check is performed by [Request.accepts()](https://expressjs.com/en/4x/api.html#req.accepts).
npm package: @myrotvorets/express-async-middleware-wrapper
Description: Wrapper for Express.js async middleware to handle rejected promises and synchronous exceptions
Author: Myrotvorets
Latest version: 2.2.0

# express-async-middleware-wrapper

[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=myrotvorets_express-async-middleware-wrapper&metric=alert_status)](https://sonarcloud.io/dashboard?id=myrotvorets_express-async-middleware-wrapper)
![Build and Test CI](https://github.com/myrotvorets/express-async-middleware-wrapper/workflows/Build%20and%20Test%20CI/badge.svg)
[![codebeat badge](https://codebeat.co/badges/8e9431d0-517a-4509-9e3f-5ce985079bda)](https://codebeat.co/projects/github-com-myrotvorets-express-async-middleware-wrapper-master)

Wrapper for Express.js async middleware to handle rejected promises and synchronous exceptions.

This library is similar to [express-async-handler](https://www.npmjs.com/package/express-async-handler) but is written in TypeScript, and its typings handle more cases than those of `express-async-handler` (for example, it can deal with the changes introduced in [DefinitelyTyped/DefinitelyTyped#49677](https://github.com/DefinitelyTyped/DefinitelyTyped/pull/49677))

# Usage

```typescript
import { Request, Response, Router } from 'express';
import wrapper from '@myrotvorets/express-async-middleware-wrapper';

async function handler(req: Request, res: Response): Promise<void> {
    const someAsyncResult = await someAsyncAction();
    res.json(someAsyncResult);
}

const router = Router();
router.get('/some-path', wrapper(handler));
```

# What it Does

It provides error handling for asynchronous middleware by catching rejected promises and synchronous exceptions from handler's code.

This wrapper simplfies development by eliminating the need to write boilerplate code for asynchronous handlers.
npm package: @myrotvorets/express-request-logger
Description: HTTP request logger middleware for Express
Author: Myrotvorets
Latest version: 1.2.3

# express-request-logger

[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=myrotvorets_express-request-logger&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=myrotvorets_express-request-logger)
[![Build and Test](https://github.com/myrotvorets/express-request-logger/actions/workflows/build.yml/badge.svg)](https://github.com/myrotvorets/express-request-logger/actions/workflows/build.yml)
[![Dependency Review](https://github.com/myrotvorets/express-request-logger/actions/workflows/dependency-review.yml/badge.svg)](https://github.com/myrotvorets/express-request-logger/actions/workflows/dependency-review.yml)
[![Package Audit](https://github.com/myrotvorets/express-request-logger/actions/workflows/package-audit.yml/badge.svg)](https://github.com/myrotvorets/express-request-logger/actions/workflows/package-audit.yml)
[![codecov](https://codecov.io/github/myrotvorets/express-request-logger/graph/badge.svg?token=3Jxv3j4PEi)](https://codecov.io/github/myrotvorets/express-request-logger)

HTTP request logger middleware for Express
npm package: @myrotvorets/fake-knex-client
Description: Fake Knex.js client
Author: Myrotvorets
Latest version: 1.1.1

# fake-knex-client

Fake Client for Knex.js

## Usage

```typescript
import * as knexpkg from 'knex';
import mockKnex from 'mock-knex';
import { FakeClient } from '@myrotvorets/fake-knex-client';

describe('...', function () {
    let db: knexpkg.Knex;

    before(function () {
        const { knex } = knexpkg.default;
        db = knex({ client: FakeClient });
        mockKnex.mock(db);
    });

    // ...
});
```

## Why

We discovered that our integration tests, which involve a real database,
don't work smoothly alongside our functional tests that use `mock-knex`
with the actual database driver when we employ `mocha` as our test runner.
This issue likely arises because `mocha`, unlike `jest`, doesn't isolate each test,
resulting in some unexpected behavior.

One potential solution we considered was to utilize a distinct database driver
for functional tests, such as `better-sqlite3`. However, this approach
would introduce a significant and unnecessary dependency to our project.
npm package: @myrotvorets/lru-cache
Description: LRU cache implementation.
Author: Myrotvorets
Latest version: 1.1.1

# lru-cache

[![Build and Test](https://github.com/myrotvorets/lru-cache/actions/workflows/build.yml/badge.svg)](https://github.com/myrotvorets/lru-cache/actions/workflows/build.yml)
[![CodeQL Analysis](https://github.com/myrotvorets/lru-cache/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/myrotvorets/lru-cache/actions/workflows/codeql-analysis.yml)
[![Package Audit](https://github.com/myrotvorets/lru-cache/actions/workflows/package-audit.yml/badge.svg)](https://github.com/myrotvorets/lru-cache/actions/workflows/package-audit.yml)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=myrotvorets_lru-cache&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=myrotvorets_lru-cache)

LRU Cache implementation in TypeScript
npm package: @myrotvorets/opentelemetry-plugin-knex
Description: OpenTelemetry knex automatic instrumentation package
Author: Myrotvorets
Latest version: 1.1.0

# opentelemetry-plugin-knex

[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=myrotvorets_opentelemetry-plugin-knex&metric=alert_status)](https://sonarcloud.io/dashboard?id=myrotvorets_opentelemetry-plugin-knex)
[![Build and Test](https://github.com/myrotvorets/opentelemetry-plugin-knex/actions/workflows/build.yml/badge.svg)](https://github.com/myrotvorets/opentelemetry-plugin-knex/actions/workflows/build.yml)

OpenTelemetry knex automatic instrumentation package

## Usage

```typescript
import { NodeSDK } from '@opentelemetry/sdk-node';
import { KnexInstrumentation } from '@myrotvorets/opentelemetry-plugin-knex';
import { HttpInstrumentation } from '@opentelemetry/instrumentation-http';

const sdk = new NodeSDK({
    serviceName: 'example',
    instrumentations: [new HttpInstrumentation(), new KnexInstrumentation()],
});

sdk.start();
```

See the [`example`](example) directory for a working example.
npm package: @myrotvorets/po2json
Description: Convers a PO files into JED compatible with WordPress i18n
Author: Myrotvorets
Latest version: 1.0.3

# po2json

[![Build](https://github.com/myrotvorets/po2json/actions/workflows/build.yml/badge.svg)](https://github.com/myrotvorets/po2json/actions/workflows/build.yml)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=myrotvorets_po2json&metric=alert_status)](https://sonarcloud.io/dashboard?id=myrotvorets_po2json)

Converts a PO file into a JED compatible with WordPress i18n

## Installation

```bash
npm i -g @myrotvorets/po2json
```

## Usage

```bash
po2json source-file.po > dest-file.json
```
npm package: @myrotvorets/promise-chunk
Description: Runs a list of native promises in chunks.
Author: Myrotvorets
Latest version: 2.0.0

# promise-chunk

[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=myrotvorets_promise-chunk&metric=alert_status)](https://sonarcloud.io/dashboard?id=myrotvorets_promise-chunk)
[![Build and Test](https://github.com/myrotvorets/promise-chunk/actions/workflows/build.yml/badge.svg)](https://github.com/myrotvorets/promise-chunk/actions/workflows/build.yml)

Runs a list of native promises in chunks.

# Example

```typescript
import promiseChunk from '@myrotvorets/promise-chunk'

function* requestGenerator(): Generator<Promise<Record<string, unknown>>> {
    const ids = ['81e', 'a46', 'SQIzfUkYJ', 'JFPROfGtQ', 'g-gQiPV-_'];
    for (const id of ids) {
        const url = `https://api.thecatapi.com/v1/images/${id}`;
        yield fetch(url).then((response) => response.json() as Promise<Record<string, unknown>>);
    }
}

async function getCats(): Promise<void> {
    const jsons = await promiseChunk(requestGenerator(), 2);
    jsons
        .filter((item): item is Record<string, unknown> => !(item instanceof Error))
        .forEach((cat) => console.log(cat.url));
}

getCats().catch((e: unknown) => console.error(e));
```
npm package: @myrpc/datconfig-core
Description: A definitive configuration language.
Author: MyRPC Maintainers
Latest version: 1.1.0

<p align=center>
    <img src="https://img.shields.io/github/repo-size/MyRPC/datconfig.svg?style=flat-square" alt="GitHub repo size in bytes">
    <img src="https://img.shields.io/github/last-commit/MyRPC/datconfig.svg?style=flat-square" alt="GitHub last commit">
    <img src="https://img.shields.io/npm/v/datconfig-parser.svg?style=flat-square" alt="npm (scoped)">
    <img src="https://img.shields.io/npm/dw/datconfig-parser.svg?style=flat-square" alt="npm">
    <img src="https://img.shields.io/librariesio/github/MyRPC/datconfig.svg?style=flat-square" alt="Libraries.io for GitHub">
    <img src="https://img.shields.io/travis/com/MyRPC/datconfig.svg?style=flat-square" alt="Travis (.org)">
    <img src="https://img.shields.io/coveralls/github/MyRPC/datconfig.svg?style=flat-square" alt="Coveralls github">
    <img src="https://img.shields.io/github/languages/top/MyRPC/datconfig.svg?style=flat-square" alt="GitHub top language"><br>
    <img src="https://img.shields.io/npm/l/datconfig-parser.svg?style=flat-square" alt="NpmLicense">
</p>
[![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square)](#contributors)

---

Parse datconfig files in JavaScript.

## Contributors

Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore -->
| [<img src="https://avatars1.githubusercontent.com/u/45880278?v=4" width="100px;"/><br /><sub><b>Landon Gravat</b></sub>](https://railrunner16.me/)<br />[💻](https://github.com/MyRPC/datconfig/commits?author=RailRunner166 "Code") [📖](https://github.com/MyRPC/datconfig/commits?author=RailRunner166 "Documentation") | [<img src="https://avatars2.githubusercontent.com/u/17152768?v=4" width="100px;"/><br /><sub><b>ThatOneGamer999</b></sub>](https://github.com/ThatOneGamer999)<br />[💻](https://github.com/MyRPC/datconfig/commits?author=ThatOneGamer999 "Code") |
| :---: | :---: |
<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!
npm package: @myrpc/documents-folder
Description: Get the local documents folder, for all major platforms
Latest version: 1.0.1


# documents-folder

  Get the local documents folder, for all major platforms.

## Usage

```js
const documentsFolder = require('@myrpc/documents-folder');

console.log(documentsFolder());
```

## Installation

```bash
$ npm install @myrpc/documents-folder
# OR
$ yarn add @myrpc/documents-folder
```

## API

### documentsFolder()

Return the location of the documents folder for the current platform.

__Warning__: On *nix, this will perform _synchronous_ operations, so don't
place it where concurrency is required. It's probably the best to just
determine this folder once when your application starts.

## Algorithm

- Mac OS X: `~/Documents`
- Windows: `~/Documents`
- *nix: `xdg-user-dir DOCUMENTS` || `~/Documents` || `/tmp`

## License

MIT
npm package: @myrror-security/cache-manager-redis-store
Description: Redis store for node-cache-manager
Author: Myrror Security
Latest version: 1.7.1

# Redis store for node cache manager (TypeScript)
[![npm version](https://badge.fury.io/js/@myrror-security%2Fcache-manager-redis-store.svg)](https://badge.fury.io/js/cache-manager-redis-store)
![GitHub issues](https://img.shields.io/github/issues/blindspot-security/node-cache-manager-redis-store)

Redis cache store for [node-cache-manager](https://github.com/node-cache-manager/node-cache-manager).

This package is a fork of [node-cache-manager-redis](https://github.com/dabroek/node-cache-manager-redis-store)

## What New?
* [x] Typescript
* [x] Async/Await
* [x] Api support for node-cache-manager v5.x.x

## Why we forked?
At version v5.x.x node-cache-manager has been rewritten in Typescript. and did major changes to the API .



Installation
------------
### NPM
```shell
npm install @myrror-security/cache-manager-redis-store --save
```
### YARN
```shell
yarn add @myrror-security/cache-manager-redis-store
```
### PNPM
```shell
pnpm install  @myrror-security/cache-manager-redis-store
```

Contribution
------------
Want to help improve this package? We take [pull requests](https://github.com/blindspot-security/node-cache-manager-redis-store/pulls).

## Status
The project is under active development.
TODO:
* [ ] Add documentation
* [ ] Add examples
* [ ] Add code coverage
* [ ] PR template
* [ ] Issues template

License
-------
The `@myrror-security/cache-manager-redis-store` is licensed under the MIT license.