Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@transcend-io/penumbra

Package Overview
Dependencies
Maintainers
9
Versions
115
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@transcend-io/penumbra - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

src/.DS_Store

7

package.json
{
"name": "@transcend-io/penumbra",
"version": "3.0.0",
"version": "3.0.1",
"description": "Crypto streams for the browser.",

@@ -19,2 +19,3 @@ "main": "build/src/index.js",

"start": "http-server build -a localhost",
"start:example": "npm run build:example && http-server example",
"####### Testing #######": "",

@@ -30,3 +31,4 @@ "test:interactive": "http-server build -a localhost",

"clean": "rimraf build",
"build": "npm run clean && mkdir -p build && webpack && cp src/demo/* build/",
"build": "npm run clean && mkdir -p build && webpack && cp src/demo/* build/ && npm run build:markdown",
"build:markdown": "markdown-toc -i --bullets '—' README.md && sed -i -e 's/—/-/g' README.md && rm -f README.md-e",
"build:watch": "tsc --watch",

@@ -89,2 +91,3 @@ "webpack:watch": "npm run clean && webpack --watch",

"http-server": "^0.11.1",
"markdown-toc": "^1.2.0",
"npm-check": "^5.9.0",

@@ -91,0 +94,0 @@ "nyc": "^14.1.1",

@@ -8,3 +8,3 @@ <p align="center">

<br /><br />
<i>Coming soon. This repo is currently a work in progress.</i>
<i>Quickly and efficiently decrypt remote resources in the browser. Display the files in the DOM, or download them with <a href="https://github.com/trasncend-io/conflux">conflux</a>.</i>
<br /><br />

@@ -20,2 +20,29 @@ <a href="https://travis-ci.com/transcend-io/penumbra"><img src="https://travis-ci.com/transcend-io/penumbra.svg?branch=master" alt="Build Status"></a>

<!-- toc -->
- [Usage](#usage)
- [Importing Penumbra](#importing-penumbra)
- [With NPM](#with-npm)
- [Vanilla JS](#vanilla-js)
- [.get](#get)
- [.save](#save)
- [.getBlob](#getblob)
- [.getTextOrURI](#gettextoruri)
- [.zip](#zip)
- [.setWorkerLocation](#setworkerlocation)
- [Examples](#examples)
- [Display encrypted text](#display-encrypted-text)
- [Display encrypted image](#display-encrypted-image)
- [Download an encrypted file](#download-an-encrypted-file)
- [Download many encrypted files](#download-many-encrypted-files)
- [Advanced](#advanced)
- [Prepare connections for file downloads in advance](#prepare-connections-for-file-downloads-in-advance)
- [Download Progress Event Emitter](#download-progress-event-emitter)
- [Configure worker location](#configure-worker-location)
- [Waiting for the `penumbra-ready` event](#waiting-for-the-penumbra-ready-event)
- [Contributing](#contributing)
- [Big Thanks](#big-thanks)
<!-- tocstop -->
## Usage

@@ -25,10 +52,31 @@

TODO
#### With NPM
```sh
npm install --save @transcend-io/penumbra
```
```js
import * as penumbra from '@transcend-io/penumbra'
penumbra.get(...files).then(penumbra.save);
```
#### Vanilla JS
```html
<script src="lib/penumbra.js"></script>
<script>
penumbra.get(...files).then(penumbra.getTextOrURI).then(displayInDOM);
</script>
```
_Check out [this guide](#waiting-for-the-penumbra-ready-event) for asynchornous loading._
### .get
Fetch and decrypt remote files
Fetch and decrypt remote files.
```ts
penumbra.get(...resources: RemoteResource[]): Promise<PenumbraFiles[]>
penumbra.get(...resources: RemoteResource[]): Promise<PenumbraFile[]>
```

@@ -38,6 +86,6 @@

Save files retrieved by Penumbra
Save files retrieved by Penumbra. Downloads a .zip if there are multiple files.
```ts
penumbra.save(data: PenumbraFiles, fileName?: string): Promise<void>
penumbra.save(data: PenumbraFile[], fileName?: string): Promise<void>
```

@@ -47,6 +95,6 @@

Load files retrieved by Penumbra into memory as a Blob
Load files retrieved by Penumbra into memory as a Blob.
```ts
penumbra.getBlob(data: PenumbraFiles): Promise<Blob>
penumbra.getBlob(data: PenumbraFile[] | PenumbraFile | ReadableStream, type?: string): Promise<Blob>
```

@@ -59,3 +107,3 @@

```ts
penumbra.getTextOrURI(data: PenumbraFiles): Promise<{ type: 'text'|'uri', data: string }>
penumbra.getTextOrURI(data: PenumbraFile[] | PenumbraFile): Promise<{ type: 'text'|'uri', data: string, mimetype: string }>
```

@@ -65,6 +113,6 @@

Zip files retrieved by Penumbra
Zip files retrieved by Penumbra.
```ts
penumbra.zip(data: PenumbraFiles, compressionLevel?: number): Promise<ReadableStream>
penumbra.zip(data: PenumbraFile[] | PenumbraFile, compressionLevel?: number): Promise<ReadableStream>
```

@@ -74,3 +122,3 @@

Configure the location of Penumbra's worker threads
Configure the location of Penumbra's worker threads.

@@ -81,12 +129,2 @@ ```ts

### `penumbra-ready` event
Listen for this event to know when Penumbra is ready to be used.
```ts
self.addEventListener('penumbra-ready', async ({ detail: { penumbra } }) => {
// await penumbra.get(...);
});
```
## Examples

@@ -265,5 +303,9 @@

```html
<script src="lib/penumbra.js" async defer></script>
```
```ts
const onReady = async ({ detail: { penumbra } } = { detail: self }) => {
// await penumbra.get(...);
await penumbra.get(...files).then(penumbra.save);
};

@@ -270,0 +312,0 @@

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc