-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Felipe Forbeck <[email protected]>
- Loading branch information
Showing
4 changed files
with
56 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,19 +4,27 @@ import { Lang, Theme } from 'shiki' | |
const w3upExample = ` | ||
import * as Client from '@web3-storage/w3up-client' | ||
import { filesFromPaths } from 'files-from-path' | ||
import * as UcantoClient from '@ucanto/client' | ||
const client = await Client.create() | ||
// first time setup! | ||
if (!Object.keys(client.accounts()).length) { | ||
// waits for you to click the link in your email to verify your identity | ||
const account = await client.login('[email protected]') | ||
// create a space for your uploads | ||
const space = await client.createSpace('lets-go') | ||
// connect to the Gateway that will serve your content | ||
const storachaGateway = UcantoClient.connect({ | ||
id: id, | ||
codec: CAR.outbound, | ||
channel: url ? HTTP.open({ url: new URL('https://freeway.dag.haus') }) : server, | ||
}) | ||
// create a space for your uploads and authorize the gateway | ||
const space = await client.createSpace('lets-go', { | ||
account, // associate this space with your account & configure recovery | ||
authorizeGatewayServices: [storachaGateway], | ||
}) | ||
// save the space to the store, and set as "current" | ||
await space.save() | ||
// associate this space with your account | ||
await account.provision(space.did()) | ||
} | ||
// content-address your files | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
# Download Source Code | ||
|
||
Download the w3up client source code and start building today. Simply click the download button below to get the complete package. | ||
Questions or need help? Check out our documentation or reach out to [email protected]. | ||
|
||
|
||
[Download here](https://github.com/storacha/w3up/archive/refs/heads/main.zip) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters