New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

dbdbdb

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dbdbdb

Utility for using the Dropbox Javascript SDK as a FS System with a hacky JSON database

latest
npmnpm
Version
0.0.7
Version published
Maintainers
1
Created
Source

DBDBDB - Simple JSON File Database Using Dropbox Javascript SDK

Prerequisites

Usage:

Install: npm i dbdbdb --save

import dbdb from "dbdbdb";

const {
  authUrl,
  getClient,
  logOutDropbox,
  readDatabase,
  updateDatabase,
  uploadImage
} = dbdb({ clientId: "YOUR_APP_KEY" });

authUrl String

A url to enable a user to authenticate with Dropbox and redirect to your app with an auth token.

Dropbox SDK Reference: http://dropbox.github.io/dropbox-sdk-js/Dropbox.html#getAuthenticationUrl

Authentication Flow Information: https://www.dropbox.com/developers/reference/oauth-guide

getClient Function

Returns a Dropbox SDK class instance. If a client instance is not yet available, it creates a new one by using a token found in sessionStorage or in the current url.

logOutDropbox Function

Removes authentication token from localStorage. You are responsible for destroying your application's SDK client instance.

readDatabase Function

Returns a Promise. Fetches the configured JSON database file from dropbox, parses the data and returns it.

Usage:

readDatabase().then(({ articles }) => {
  // do something with articles
});

updateDatabase Async Function

Returns a Promise. Reads the current database, then peforms a shallow merge of that with the new data provided in argument.

Usage:

updateDatabase({ data: { articles: [{ title: "My Article" }] } });

uploadImage Async Function

Returns a file object containing a public image url.

Usage:

const image = await uploadImage({ file: { ... } });
console.log(image.url); // https://public-url-to-image

See React example

FAQs

Package last updated on 31 May 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts