Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
node_modules
.idea
yarn.lock
dist
66 changes: 0 additions & 66 deletions CHANGELOG.md

This file was deleted.

57 changes: 57 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# snappy-stream

Compress data over a Stream using the snappy framing format


## Installation

```
npm install @scottypoi/snappy-stream
```


## Example

### Input

```typescript
// ./example.ts
```

### Output

```
Som data from the compressed stream <Buffer ff 06 00 00 73 4e 61 50 70 59>
Som data from the compressed stream <Buffer 01 09 00 00 bb 1f 82 a2 68 65 6c 6c 6f>
The data that was originally written
hello
Som data from the compressed stream <Buffer 01 09 00 00 2d 4e 1f a5 77 6f 72 6c 64>
The data that was originally written
world
```



## Licence

Copyright (c) 2025 ScottyPoi

This software is released under the MIT license:

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.
81 changes: 0 additions & 81 deletions benchmark.js

This file was deleted.

19 changes: 0 additions & 19 deletions example.js

This file was deleted.

23 changes: 23 additions & 0 deletions example.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { createCompressStream, createUncompressStream } from './src/index.ts';

// Create streams with proper type annotations
const compressStream = createCompressStream();
const uncompressStream = createUncompressStream({
asBuffer: false // Optional: emit strings instead of buffers
});

// Set up event handlers with proper types
compressStream.on('data', (chunk: Uint8Array) => {
console.log('Some data from the compressed stream:', chunk);
uncompressStream.write(chunk);
});

uncompressStream.on('data', (chunk: string) => {
console.log('The data that was originally written:');
console.log(chunk);
});

// Write some data
compressStream.write('hello');
compressStream.write('world');
compressStream.end();
11 changes: 0 additions & 11 deletions index.js

This file was deleted.

Loading
Loading