Skip to content

Commit

Permalink
Merge pull request #294 from earthstar-project/deno-version-warning
Browse files Browse the repository at this point in the history
Deno version warning
  • Loading branch information
sgwilym committed Jan 2, 2023
2 parents 05f3958 + 7fcd7da commit 3b1623c
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/deno.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ name: Deno CI

on:
push:
branches: [main, squirrel]
branches: [main]
pull_request:
branches: [main, squirrel]
branches: [main]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
deno-version: ["1.25.1"]
deno-version: ["1.29.1"]

steps:
- uses: actions/checkout@v2
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ Or Deno:
import * as Earthstar from "https://deno.land/x/earthstar@v10.0.0/mod.ts";`}
```

> Earthstar's syncing does not work with version of Deno between 1.27.0 - 1.28.1
> Earthstar's syncing does not work with version of Deno between 1.27.0 - 1.28.3
> (inclusive) due to a regression in these versions' WebSocket implementation.
> **Use Deno 1.29.0 or higher.**

or installed with NPM:

Expand Down
5 changes: 4 additions & 1 deletion src/replica/attachment_drivers/filesystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ export class AttachmentDriverFilesystem implements IReplicaAttachmentDriver {
}

try {
const file = await Deno.open(stagingPath, { create: true, write: true });
const file = await Deno.open(stagingPath, {
createNew: true,
write: true,
});
await attachment.pipeThrough(attachmentStreamInfo).pipeTo(file.writable);
} catch {
return new EarthstarError("Couldn't write data to the staging path");
Expand Down
6 changes: 5 additions & 1 deletion src/sync-fs/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,11 @@ export async function writeDocToDir(
}

try {
const file = await Deno.open(pathToWrite, { create: true, write: true });
const file = await Deno.open(pathToWrite, {
create: true,
write: true,
truncate: true,
});
await (await attachment.stream()).pipeTo(file.writable);
} catch {
throw new EarthstarError("Could not write attachment to filesystem");
Expand Down
2 changes: 1 addition & 1 deletion src/syncer/transfer_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class TransferManager<FormatsType, IncomingAttachmentSourceType> {
const res = await agent.replica.getAttachment(event.doc, format);

if (isErr(res)) {
// This doc can't have a attachment attached. Do nothing.
// This doc can't have an attachment attached. Do nothing.
return;
} else if (res === undefined) {
await handleDownload(
Expand Down

0 comments on commit 3b1623c

Please sign in to comment.