@heyputer/puter.js 2.0.11 → 2.0.12
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/README.md +43 -20
- package/dist/puter.js +1 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,29 +1,43 @@
|
|
|
1
|
-
|
|
1
|
+
<h3 align="center">Puter.js</h3>
|
|
2
2
|
|
|
3
|
-
The official JavaScript SDK for
|
|
3
|
+
<p align="center">The official JavaScript SDK for <a href="https://puter.com">Puter.com</a></p>
|
|
4
|
+
<p align="center">Free, Serverless, Cloud and AI from the frontend code.</p>
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
<p align="center">
|
|
7
|
+
<a href="https://developer.puter.com" target="_blank">Learn More</a>
|
|
8
|
+
·
|
|
9
|
+
<a href="https://docs.puter.com" target="_blank">Docs</a>
|
|
10
|
+
·
|
|
11
|
+
<a href="https://developer.puter.com/tutorials">Tutorials</a>
|
|
12
|
+
·
|
|
13
|
+
<a href="https://github.com/Puter-Apps/">Examples</a>
|
|
14
|
+
·
|
|
15
|
+
<a href="https://twitter.com/HeyPuter">X</a>
|
|
16
|
+
</p>
|
|
6
17
|
|
|
7
|
-
## Installation (npm)
|
|
8
18
|
|
|
19
|
+
<br>
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### NPM:
|
|
9
25
|
```sh
|
|
10
26
|
npm install @heyputer/puter.js
|
|
11
27
|
```
|
|
12
28
|
|
|
13
|
-
###
|
|
29
|
+
### CDN:
|
|
14
30
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
```js
|
|
18
|
-
const {init} = require("@heyputer/puter.js/src/init.cjs"); // NODE JS ONLY
|
|
19
|
-
// or
|
|
20
|
-
import {init} from "@heyputer/puter.js/src/init.cjs";
|
|
31
|
+
Include Puter.js directly in your HTML via CDN in the `<head>` section:
|
|
21
32
|
|
|
22
|
-
|
|
23
|
-
|
|
33
|
+
```html
|
|
34
|
+
<script src="https://js.puter.com/v2/"></script>
|
|
24
35
|
```
|
|
36
|
+
<br>
|
|
25
37
|
|
|
26
|
-
|
|
38
|
+
## Usage
|
|
39
|
+
|
|
40
|
+
### Browser
|
|
27
41
|
|
|
28
42
|
#### ES Modules
|
|
29
43
|
|
|
@@ -45,14 +59,19 @@ const puter = require('@heyputer/puter.js');
|
|
|
45
59
|
require('@heyputer/puter.js'); // puter will be available globally
|
|
46
60
|
```
|
|
47
61
|
|
|
48
|
-
|
|
62
|
+
### Node.js (with Auth Token)
|
|
49
63
|
|
|
50
|
-
|
|
64
|
+
```js
|
|
65
|
+
const {init} = require("@heyputer/puter.js/src/init.cjs"); // NODE JS ONLY
|
|
66
|
+
// or
|
|
67
|
+
import {init} from "@heyputer/puter.js/src/init.cjs";
|
|
51
68
|
|
|
52
|
-
|
|
53
|
-
|
|
69
|
+
const puter = init(process.env.puterAuthToken); // uses your auth token
|
|
70
|
+
const puter2 = init(process.env.puterAuthToken2); // use some other auth token
|
|
54
71
|
```
|
|
55
72
|
|
|
73
|
+
<br>
|
|
74
|
+
|
|
56
75
|
## Usage Example
|
|
57
76
|
|
|
58
77
|
After importing, you can use the global `puter` object:
|
|
@@ -67,7 +86,7 @@ puter.ai.chat('What color was Napoleon\'s white horse?').then(response => {
|
|
|
67
86
|
});
|
|
68
87
|
```
|
|
69
88
|
|
|
70
|
-
|
|
89
|
+
<br>
|
|
71
90
|
|
|
72
91
|
## Documentation & Community
|
|
73
92
|
|
|
@@ -77,4 +96,8 @@ puter.ai.chat('What color was Napoleon\'s white horse?').then(response => {
|
|
|
77
96
|
- [Puter.com](https://puter.com)
|
|
78
97
|
- [Discord](https://discord.com/invite/PQcx7Teh8u)
|
|
79
98
|
- [Reddit](https://reddit.com/r/puter)
|
|
80
|
-
- [X (Twitter)](https://twitter.com/HeyPuter)
|
|
99
|
+
- [X (Twitter)](https://twitter.com/HeyPuter)
|
|
100
|
+
|
|
101
|
+
## License
|
|
102
|
+
|
|
103
|
+
Apache-2.0
|