Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!(sdk): Remove 'toFile' method #403

Merged
merged 2 commits into from
Dec 12, 2024
Merged

Conversation

dmihalcik-virtru
Copy link
Member

This removes a dependency on streamsaver.js. The equivalent function to this method is now viewable in the App.tsx file:

async function toFile(
  stream: ReadableStream<Uint8Array>,
  filepath = 'download.tdf',
  options?: {
    encoding?: BufferEncoding;
    signal?: AbortSignal;
  }
): Promise<void> {

  const fileStream = streamsaver.createWriteStream(filepath, {
    writableStrategy: { highWaterMark: 1 },
    readableStrategy: { highWaterMark: 1 },
  });

  return stream.pipeTo(fileStream, options);
}

@dmihalcik-virtru dmihalcik-virtru requested a review from a team as a code owner December 12, 2024 15:14
This removes a dependency on streamsaver.js. The equivalent function to this method is now viewable in the `App.tsx` file:

```ts
async function toFile(
  stream: ReadableStream<Uint8Array>,
  filepath = 'download.tdf',
  options?: {
    encoding?: BufferEncoding;
    signal?: AbortSignal;
  }
): Promise<void> {

  const fileStream = streamsaver.createWriteStream(filepath, {
    writableStrategy: { highWaterMark: 1 },
    readableStrategy: { highWaterMark: 1 },
  });

  return stream.pipeTo(fileStream, options);
}
```
Copy link

If these changes look good, signoff on them with:

git pull && git commit --amend --signoff && git push --force-with-lease origin

If they aren't any good, please remove them with:

git pull && git reset --hard HEAD~1 && git push --force-with-lease origin

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)
9.1% Duplication on New Code (required ≤ 8%)

See analysis details on SonarQube Cloud

@dmihalcik-virtru dmihalcik-virtru merged commit 31939dc into main Dec 12, 2024
11 of 12 checks passed
@dmihalcik-virtru dmihalcik-virtru deleted the feature/streaamsaveless branch December 12, 2024 18:21
elizabethhealy pushed a commit that referenced this pull request Dec 13, 2024
This removes a dependency on streamsaver.js. The equivalent function to this method is now viewable in the `App.tsx` file:

```ts
async function toFile(
  stream: ReadableStream<Uint8Array>,
  filepath = 'download.tdf',
  options?: {
    encoding?: BufferEncoding;
    signal?: AbortSignal;
  }
): Promise<void> {

  const fileStream = streamsaver.createWriteStream(filepath, {
    writableStrategy: { highWaterMark: 1 },
    readableStrategy: { highWaterMark: 1 },
  });

  return stream.pipeTo(fileStream, options);
}
```

Signed-off-by: Elizabeth Healy <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants