open-index/open-npm huggingface dataset:
npm package: @ssttevee/blob-ponyfill
Description: Implementation of the Web APIs' Blob interface using modern javascript.
Author: ssttevee
Latest version: 0.1.0

# Description

Implementation of the Web APIs' `Blob` interface using modern javascript.

`File`, `FileReader`, and `FileReaderSync` are also included because they are part of the same api spec.

This package may use potentially missing interfaces, like `EventTarget`, without any reservation. Please use a different package to fill in the gaps.

# Installation

```bash
npm install @ssttevee/blob-ponyfill
```

# Importing

```js
import Blob, { /* Blob, */ File, FileReader, FileReaderSync } from '@ssttevee/blob-ponyfill';
```

or if bundle size is a concern

```js
import Blob from '@ssttevee/blob-ponyfill/blob';
import File from '@ssttevee/blob-ponyfill/file';
import FileReader from '@ssttevee/blob-ponyfill/filereader';
import FileReaderSync from '@ssttevee/blob-ponyfill/filereadersync';
```

# Usage

It's probably best if this package is used with a bundler like webpack or rollup and injected with the [`webpack.ProvidePlugin`](https://webpack.js.org/guides/shimming/) or [`rollup-inject-plugin`](https://github.com/rollup/rollup-plugin-inject) respectively.

## Webpack

```js
// webpack.config.js
const webpack = require('webpack');

module.exports = {
    // other config
    plugins: [
        new webpack.ProvidePlugin({
            Blob: '@ssttevee/blob-ponyfill',
            File: ['@ssttevee/blob-ponyfill', 'File'],
        })
    ]
    // more config
};
```

## Rollup

```js
// rollup.config.js
import inject from 'rollup-plugin-inject';

export default {
    // other config
    plugins: [
        inject({
            Blob: '@ssttevee/blob-ponyfill',
            File: ['@ssttevee/blob-ponyfill', 'File'],
        }),
    ],
    // more config
};
```
npm package: @ssttevee/cfw-formdata-polyfill
Description: A polyfill for Request.prototype.formData on cloudflare workers
Author: ssttevee
Latest version: 0.2.1

# TL;DR

A polyfill for `Request.prototype.formData` on cloudflare workers because they're not compliant to the [whatwg spec](https://fetch.spec.whatwg.org/#dom-body-formdata) even though [their documentation suggests otherwise](https://developers.cloudflare.com/workers/reference/runtime/apis/fetch/#methods-1).

## Installation

```bash
npm install @ssttevee/cfw-formdata-polyfill
```

## Usage

```js
import `@ssttevee/cfw-formdata-polyfill`;

// get req from handler

const fd = await req.formData();
```

or if a [ponyfill](https://ponyfill.com/) is more preferrable

```js
import FormDataFromRequest from '@ssttevee/cfw-formdata-polyfill/ponyfill';

// get req from handler

const fd = await FormDataFromRequest.call(req);
```

## Examples

There are some full examples in the [examples directory](https://github.com/ssttevee/cfw-formdata-polyfill/tree/master/src).

# Native `Request.prototype.formData` on Cloudflare Workers

Since before the public launch of Cloudflare Workers until the time of writing, `Request.prototype.formData` has been able to handle `application/x-www-form-urlencoded` payloads as one would expect. However, their support for `multipart/form-data` has been... undocumented. 

## Native `multipart/form-data` support

The native `Request.prototype.formData` does technically support `multipart/form-data`. However, files are returned as binary strings rather than a Blob. That means the filename and content type metadata is lost. Though this is somewhat justified upon closer inspection of the environment.

## The FormData API

The FormData API, as long as no files are involved, seems to work as one would expect. However, advanced users will quickly realize that it cannot be used to construct `multipart/form-data` payloads to be used with `fetch`. It doesn't even accept any type other than strings. This is because the Blob API doesn't exist on Cloudflare Workers.

## The Blob API

The Blob API, as designed for the browser, is meant to be an abstraction for reading arbitrary data, outside of the browser sandbox, from the operating system. Meanwhile, there is no parallel in the Cloudflare Workers environment. This, I believe, is the primary reason that this halfway point for the FormData API exists on Cloudflare Workers.

## Polyfilling

This package was designed to be used in conjuction with a bundler -- I prefer rollup -- to fix `Request.prototype.formData` and to be able to use it for receiving `multipart/form-data` uploads.
npm package: @ssttevee/formdata-ponyfill
Description: Implementation of the Web APIs' `FormData` interface using modern javascript.
Author: ssttevee
Latest version: 0.1.4

# Description

Implementation of the Web APIs' `FormData` interface using modern javascript.

This package may use potentially missing interfaces, like `Blob`, without any reservation. Please use a different package to fill in the gaps.

# Installation

```bash
npm install @ssttevee/formdata-ponyfill
```
npm package: @ssttevee/multipart-parser
Description: A simple multipart/form-data parser for web streams
Author: ssttevee
Latest version: 0.1.9

# Description

A simple `multipart/form-data` parser for use with `ReadableStream`s.

# Installation

```bash
npm install @ssttevee/multipart-parser
```

# Example

```js
import { parseMultipart } from '@ssttevee/multipart-parser';

...

async function requestHandler(req) {
    const boundary = '----whatever';
    const parts = await parseMultipart(req.body, boundary);
    const fd = new FormData();
    for (const { name, data, filename, contentType } of parts) {
        if (filename) {
            fd.append(name, new Blob([data], { type: contentType }), filename);
        } else {
            fd.append(name, new TextDecoder().decode(data), filename);
        }
    }
}
```
npm package: @ssttevee/streamsearch
Description: A port of streamsearch for es modules using Web APIs
Author: ssttevee
Latest version: 0.4.0

[![codecov](https://codecov.io/gh/ssttevee/streamsearch/branch/master/graph/badge.svg)](https://codecov.io/gh/ssttevee/streamsearch)

# Description

This module is a port of [streamsearch](https://github.com/mscdex/streamsearch) for es modules using Web APIs, namely `ReadableStream` and `Uint8Array`.

Node's `stream.Readable` can be used with `IterableStreamSearch` class starting from [v11.14.0](https://nodejs.org/api/stream.html#readablesymbolasynciterator).

# Installation

```bash
npm install @ssttevee/streamsearch
```

# Example

```js
import { ReadableStreamSearch, iterateStrings } from '@ssttevee/streamsearch';

const res = await fetch('https://httpbin.org/stream/10');
const search = new ReadableStreamSearch('\n', res.body);

for await (const str of iterateStrings(search)) {
    console.log(str);
}
```

Each function can also be imported individually for bundling efficiency.

```js
import { iterateStrings } from '@ssttevee/streamsearch/iterate-strings';
import { IteratorStreamSearch } from '@ssttevee/streamsearch/iterator';
```

# API

## Classes

### `StreamSearch`

**Constructor:** `new StreamSearch(needle: Uint8Array | string)`

Base class that implements the Boyer-Moore-Horspool algorithm. Use `feed(chunk: Uint8Array)` to push data and `end()` to get remaining data. Returns an array of `Token` (either `Uint8Array` chunks or `MATCH` symbols).

### `IteratorStreamSearch`

**Constructor:** `new IteratorStreamSearch(needle: Uint8Array | string, iter: AsyncIterable<Uint8Array>)`

Wraps an async iterable (e.g., Node.js streams with `Symbol.asyncIterator`). Implements `AsyncIterable<Token>`.

### `QueueableStreamSearch`

**Constructor:** `new QueueableStreamSearch(needle: Uint8Array | string)`

Manual push-based interface. Use `push(...chunks: Uint8Array[])` to add data and `close()` when done. Implements `AsyncIterable<Token>`.

### `ReadableStreamSearch`

**Constructor:** `new ReadableStreamSearch(needle: Uint8Array | string, stream: ReadableStream<Uint8Array>)`

Wraps a Web `ReadableStream`. Implements `AsyncIterable<Token>`.

## Helper functions

### `iterateChunks(iter: AsyncIterable<Token>): AsyncIterableIterator<Uint8Array[]>`

Yields arrays of `Uint8Array` chunks between matches. Each match produces a separate array.

### `iterateChunksConcatted(iter: AsyncIterable<Token>): AsyncIterableIterator<Uint8Array>`

Like `iterateChunks` but concatenates each chunk array into a single `Uint8Array`.

### `iterateStrings(iter: AsyncIterable<Token>): AsyncIterableIterator<string>`

Yields UTF-8 decoded strings between matches.

### `split(chunks: Uint8Array | Uint8Array[], needle: Uint8Array | string): Uint8Array[]`

Synchronous split function. Returns an array of `Uint8Array` chunks split by the needle.
npm package: @ssttevee/xml-parser
Description: A simple, zero-dependency XML parser that uses the [iterator interface](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols).
Author: ssttevee
Latest version: 0.1.1

# Iterator-based XML Parser

A simple, zero-dependency XML parser that uses the [iterator interface](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols).

## Basic Usage

```js
for (const node of parse('<hello>world</hello>')) {
    console.log(node);
    // prints:
    //   { "type": "opentag", "opentag": { "name": "hello", "empty": false, "attributes": {} } }
    //   { "type": "text", "text": "world" }
    //   { "type": "closetag", "closetag": "hello" }
}
```

```js
const res = await fetch('https://www.w3schools.com/xml/note.xml');
for await (const node of parseStream(res.body)) {
    console.log(node);
    // prints:
    //   { "type": "xmldecl", "xmldecl": { "version": "1.0", "encoding": "UTF-8" } }
    //   { "type": "text", "text": "\n" }
    //   { "type": "opentag", "opentag": { "name": "note", "empty": false, "attributes": {} } }
    //   { "type": "text", "text": "\n  " }
    //   { "type": "opentag", "opentag": { "name": "to", "empty": false, "attributes": {} } }
    //   { "type": "text", "text": "Tove" }
    //   { "type": "closetag", "closetag": "to" }
    //   { "type": "text", "text": "\n  " }
    //   { "type": "opentag", "opentag": { "name": "from", "empty": false, "attributes": {} } }
    //   { "type": "text", "text": "Jani" }
    //   { "type": "closetag", "closetag": "from" }
    //   { "type": "text", "text": "\n  " }
    //   { "type": "opentag", "opentag": { "name": "heading", "empty": false, "attributes": {} } }
    //   { "type": "text", "text": "Reminder" }
    //   { "type": "closetag", "closetag": "heading" }
    //   { "type": "text", "text": "\n  " }
    //   { "type": "opentag", "opentag": { "name": "body", "empty": false, "attributes": {} } }
    //   { "type": "text", "text": "Don't forget me this weekend!" }
    //   { "type": "closetag", "closetag": "body" }
    //   { "type": "text", "text": "\n" }
    //   { "type": "closetag", "closetag": "note" }
}
```

## Advanced Usage

```js
const p = new Parser();
p.write('<hello>wor');
for (const node of p) {
    console.log(node);
    // prints:
    //   { "type": "opentag", "opentag": { "name": "hello", "empty": false, "attributes": {} } }
}
p.write('ld</hello>asdf');
for (const node of p) {
    console.log(node);
    // prints:
    //   { "type": "text", "text": "world" }
    //   { "type": "closetag", "closetag": "hello" }
}
p.close();
for (const node of p) {
    console.log(node);
    // prints:
    //   { "type": "text", "text": "asdf" }
}
```

## Importing

### NodeJS

```sh
npm install @ssttevee/xml-parser
```

```js
import { Parser, parse, parseStream } from '@ssttevee/xml-parser';
```

### Deno

```ts
import { Parser, parse, parseStream } from 'https://raw.githubusercontent.com/ssttevee/js-iterator-based-xml-parser/trunk/mod.ts';
```

OR

```ts
import { Parser, parse, parseStream } from "https://unpkg.com/@ssttevee/xml-parser/mod.ts";
```