npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@finerpoint/remarkable-typescript

v1.1.3

Published

A typescript reMarkable Cloud API

Downloads

5

Readme

reMarkable-typescript

This project was inspired by the work of https://github.com/kevlened/remarkable-node, adding typing and new features like the upload of a document.

Unofficial reMarkable api wrapper for node.js based on these unofficial docs. This module is typed for TypeScript, but you can still use JavaScript with it.

Installation

yarn add remarkable-typescript
# OR
npm install remarkable-typescript

Then, go to reMarkable's website to genereate a code to pair your reMarkable. This code is only available 5 minutes.

Example

import { Remarkable, ItemResponse } from 'remarkable-typescript';
// const { Remarkable, ItemResponse } = require('remarkable-typescript');
const fs = require('fs');

(async () => {
    /*
    * Create the reMarkable client
    * Params: { deviceToken?: string }
    * Returns: client: Remarkable
    */
    const client = new Remarkable();

    /*
    * Register your reMarkable and generate a device token. You must do this first to pair your device if you didn't specify a token. This may take a few seconds to complete. It seems that the deviceToken never expires.
    * Params: { code: string }
    * Returns: deviceToken: string
    */
    const deviceToken = await client.register({ code: 'created code' });

    // (optional) skip registration in the future with `new Remarkable({deviceToken})`
    console.log(deviceToken);

    /*
    * (Re)generate a token from the deviceToken. You MUST call this function after creating the client. This token, used to interact with storage, is different from the deviceToken. This function is automatically called in register(). This token expires.
    * Params: none
    * Returns: token: string
    */
    await client.refreshToken();

    /*
    * List all items, files and folders.
    * Params: none
    * Returns: ItemResponse[]
    */
    const items = await client.getAllItems();

    /*
    * Get an item by id
    * Params: id: string
    * Returns: ItemResponse | null
    */
    const item = await client.getItemWithId('some uuid');

    /*
    * Delete an item by is ID and document version
    * Params: id: string, version: number
    * Returns: success: boolean
    */
    await client.deleteItem('some uuid', 1);

    const myPDF = fs.readFileSync('./my/PDF/location.pdf');
    /*
    * Upload a PDF to your reMarkable
    * Params: name: string, file: Buffer
    * Returns: id: string
    */
    const pdfUploadedId = await client.uploadPDF('My PDF name', myPDF);

    /*
    * Download a ZIP file to your reMarkable (with the annotations)
    * Params: id: string
    * Returns: Buffer
    */
    const zipFile = await client.downloadZip(pdfUploadedId);

    /*
    * Upload a ZIP file to your reMarkable (must be a supported reMarkable format). You can generate the ID using uuidv4.
    * Params: name: string, id: string, zipFile: Buffer
    * Returns: id: string
    */
    const zipFileId = await client.uploadZip('My document name', ID: 'f831481c-7d2d-4776-922d-36e708d9d680', zipFile);

    /*
    * Upload an ePub file to your reMarkable (must be a supported reMarkable format). You can generate the ID using uuidv4 or v5. v5 will deterministically generate a uuid based on name and namespace .
    * Params: name: string, id: string, epubFileBuffer: Buffer, parent?: string
    * Returns: id: string
    */
    const epubDocId = await client.uploadEPUB('name of ePub document', ID: '181a124b-bbdf-4fdd-8310-64fa87bc9c7f', epubFileBuffer, /*optional UUID of parent folder*/);

    /*
    * Create a directory 
    * Params: name: string, id: string, epubFileBuffer: Buffer, parent?: string
    * Returns: id: string
    */
    const directoryId = await client.createDirectory('testDir2', id, ID: '702ba145-0a78-4e19-9324-6f8fb3da3c1a', /*optional UUID of parent folder*/);

})();

License

MIT