dsfs-remote

0.2.0 • Public • Published

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))

Readme

Keywords

none

Package Sidebar

Install

npm i dsfs-remote

Weekly Downloads

1

Version

0.2.0

License

none

Unpacked Size

36.2 kB

Total Files

11

Last publish

Collaborators

  • colshacol