rmapi-js 6.0.0 → 8.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 +1 -1
- package/README.md +29 -23
- package/dist/index.d.ts +737 -67
- package/dist/index.js +810 -145
- package/dist/lru.d.ts +8 -0
- package/dist/lru.js +64 -0
- package/dist/rmapi-js.esm.min.js +21 -1
- package/package.json +16 -14
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -5,22 +5,18 @@
|
|
|
5
5
|
[](https://www.npmjs.com/package/rmapi-js)
|
|
6
6
|
[](LICENSE)
|
|
7
7
|
|
|
8
|
-
JavaScript implementation of the reMarkable api.
|
|
9
|
-
|
|
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,40 @@ await api.uploadEpub("name", buffer);
|
|
|
48
44
|
await api.uploadPdf("name", buffer);
|
|
49
45
|
```
|
|
50
46
|
|
|
51
|
-
|
|
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
|
-
|
|
54
|
-
|
|
55
|
-
`node --experimental-fetch`
|
|
50
|
+
```ts
|
|
51
|
+
// ...
|
|
56
52
|
|
|
57
|
-
|
|
53
|
+
// upload with custom line height not avilable through reMarkable
|
|
54
|
+
await api.putEpub("name", buffer, { lineHeight: 180 })
|
|
58
55
|
|
|
59
|
-
|
|
60
|
-
|
|
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
|
-
|
|
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
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
|
-
|
|
72
|
+
## Users
|
|
72
73
|
|
|
73
|
-
|
|
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
|
|
76
|
+
- [reMarkable Digest](https://digest.ferrucc.io) - create and receive a daily digest on your reMarkable
|
|
74
77
|
|
|
75
78
|
## Contributing
|
|
76
79
|
|
|
77
|
-
|
|
80
|
+
Since this has all been reverse engineered, any help expanding the api would be
|
|
81
|
+
helpful. For example, There's currently a function to download the entire state
|
|
82
|
+
of a document, but I ran into trouble trying to reupload that exact same file as
|
|
83
|
+
a clone.
|