rmapi-js 6.0.0 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2022 Erik Brinkman
3
+ Copyright (c) 2024 Erik Brinkman
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -5,22 +5,18 @@
5
5
  [![npm](https://img.shields.io/npm/v/rmapi-js)](https://www.npmjs.com/package/rmapi-js)
6
6
  [![license](https://img.shields.io/github/license/erikbrinkman/rmapi-js)](LICENSE)
7
7
 
8
- JavaScript implementation of the reMarkable api. This implementation is built
9
- around web standards for fetch, but can easily be patched to work for node. It
10
- should also be pretty easy to customize to work with
8
+ JavaScript implementation of the reMarkable api. It should also be pretty easy
9
+ to customize to work with
11
10
  [rmfakecloud](https://github.com/ddvk/rmfakecloud), although that might take a
12
11
  little bit of extra plumbing.
13
12
 
14
- reMarkable keep updating their API, makig it hard to keep all features
15
- functioning. The current version is based on the api used by reMarkables web uploader and file viewer. While this api works for moving and uploading, it doesn't support more fine-grained access to document configuration, or downloading.
16
-
17
13
  ## API
18
14
 
19
15
  Before using this API it's necessary to have some rudimentary understanding of
20
16
  how the API works.
21
17
 
22
18
  All data is stored via its sha256 hash. This includes raw files ("documents")
23
- and folders ("collections"). The hash indicates the full current state to manage simultaneous edits. Most entries or edits will take an input hash, and return an output hash. Additionally, every entry has an id, which is a uuid4, and remains constantant over the lifetime of the file. There are two special ids, "" (the empty string) which corresponds to the root collection, e.g. the default location for all files, and "trash", which is the trash.
19
+ and folders ("collections"). The hash indicates the full current state to manage simultaneous edits. Most entries or edits will take an input hash, and return an output hash. Additionally, every entry has an id, which is a uuid4, and remains constantant over the lifetime of the file or folder. There are two special ids, "" (the empty string) which corresponds to the root collection, e.g. the default location for all files, and "trash", which is the trash.
24
20
 
25
21
  ## Usage
26
22
 
@@ -48,30 +44,39 @@ await api.uploadEpub("name", buffer);
48
44
  await api.uploadPdf("name", buffer);
49
45
  ```
50
46
 
51
- ### Node
47
+ There are alos low level apis that more directly manipulate cloud storage.
48
+ Using these apis is a little riskier since they can potentially result in data loss, but it does come with increased flexibility.
52
49
 
53
- This uses web standards by default, so using within node takes a little more effort. You also need to have a globally defined fetch. There are several ways to
54
- accomplish this. In node 17.5 or higher you can enable global fetch with
55
- `node --experimental-fetch`
50
+ ```ts
51
+ // ...
56
52
 
57
- You can also rely on `"node-fetch"` which is compliant enough
53
+ // upload with custom line height not avilable through reMarkable
54
+ await api.putEpub("name", buffer, { lineHeight: 180 })
58
55
 
59
- ```js
60
- import fetch from "node-fetch";
61
- global.fetch = fetch;
56
+ // fetch an uploaded pdf, using the hash (from listFiles)
57
+ const buffer = await api.getEpub(hash)
62
58
  ```
63
59
 
64
- or
60
+ ### Gotchas
61
+
62
+ By default, all calls try to do their best to verify that the input and output
63
+ matches what I expect. However, since I reverse-engineered this, some of it
64
+ could be wrong. If you ever run into a `ValidationError` and know you want
65
+ whatever data is returned, You'll have to use the low-level api under `api.raw`
66
+ to access the raw text file and parse the result yourself.
65
67
 
66
- ```js
67
- import fetch from "node-fetch";
68
- const api = await remarkable(token, { fetch });
69
- ```
68
+ It seems that exporting happens within the apps themselves, which will require
69
+ layout of the remarkable file structure. That's currently outside the scope of
70
+ this project.
70
71
 
71
- ### Gotchas
72
+ ## Users
72
73
 
73
- By default, all calls try to do their best to verify that the input and output matches what I expect. However, since I reverse-engineered this, some of it could be wrong. If you ever run into a `ValidationError` and know you want whatever data is returned, simply pass `{ verify: false }` in the options to that API, and that should temporarily remove the blocker. However note that in instances like this, the typescript types will be wrong.
74
+ - [✉️ Send Via](https://sendvia.me/) [[github](https://github.com/PaulKinlan/send-to-remarkable)] - upload to reMarkable via email
75
+ - [ⓡ rePub](https://chromewebstore.google.com/detail/repub/blkjpagbjaekkpojgcgdapmikoaolpbl) [[github](https://github.com/hafaio/repub)] - web clipper for reMarkable that supports images and customization
74
76
 
75
77
  ## Contributing
76
78
 
77
- Thie current API provides high level limited access. I'd love to reverse engineer what the apps use so this can one again tweak document settings as well as download files. Any help doing this or suggesting approaches would be grealy appreciated!
79
+ Since this has all been reverse engineered, any help expanding the api would be
80
+ helpful. For example, There's currently a function to download the entire state
81
+ of a document, but I ran into trouble trying to reupload that exact same file as
82
+ a clone.