Last active
April 27, 2022 14:19
-
-
Save janniks/054a8687e57d6eb87dd83094b71fa0fd to your computer and use it in GitHub Desktop.
putFile — Stacks Storage
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
import { AppConfig, UserSession } from "@stacks/connect"; | |
import { Storage } from "@stacks/storage"; | |
const appConfig = new AppConfig(["store_write", "publish_data"]); | |
const userSession = new UserSession({ appConfig }); | |
const storage = new Storage({ userSession }); | |
const fileName = "car.json"; | |
const fileData = { | |
color: "blue", | |
electric: true, | |
purchaseDate: "2019-04-03", | |
}; | |
const options = { | |
encrypt: true, | |
}; | |
const fileUrl = await storage.putFile(fileName, JSON.stringify(fileData), options) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment