dsfs-remote
A simple HTTP client built on top of axios that allows you to interact with Dreamtsoft's
filesystem REST API.
Usage
createDreamtsoftClient
import { createDreamtsoftClient } from "dsfs-remote"
const dsfsRemote = createDreamtsoftClient({
url: "https://foo.dreamtsoft.com",
space: "Bar",
bundle: "baz",
username: "foobar",
password: "bazbah"
})
getPathInfo
dsfsRemote
.getPathInfo("/content/js/foo.js")
.then((data) => console.log(data))
.catch((error) => console.log(error))
readFile
dsfsRemote
.readFile("/components/foo_bar/FooBarClient.html")
.then((data) => console.log(data))
.catch((error) => console.log(error))
writeFile
If the file does not exist in the DS filesystem, it is created.
If the directory does not exist, it is created, as well. (Recursive.)
dsfsRemote
.writeFile('/content/js/foo.js', '/* file contents */')
.then((data) => console.log({ data ))
.catch((error) => console.log({ data }))
createFile
If the directory does not exist, it is created. (Recursive.)
dsfsRemote
.writeFile('/modules/yolo.js')
.then((data) => console.log({ data ))
.catch((error) => console.log({ data }))
deleteFile
dsfsRemote
.deleteFile("/components/foo_bar/FooBarClient.html")
.then((data) => console.log(data))
.catch((error) => console.log(error))
readDirectory
dsfsRemote
.readDirectory("/components")
.then((data) => console.log(data))
.catch((error) => console.log(error))
createDirectory
Creates directories recursively.
dsfsRemote
.createDirectory("/components/foo/bar/baz")
.then((data) => console.log(data))
.catch((error) => console.log(error))