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