@spider-cloud/spider-client 0.0.35 → 0.0.36
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 +3 -3
- package/dist/client.d.ts +2 -2
- package/dist/client.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -93,13 +93,13 @@ spider
|
|
|
93
93
|
|
|
94
94
|
#### Download storage data
|
|
95
95
|
|
|
96
|
-
To download stored data like raw HTML or markdown use the `
|
|
96
|
+
To download stored data like raw HTML or markdown use the `createSignedUrl` method. Provide the website name and an object containing query parameters:
|
|
97
97
|
|
|
98
98
|
```javascript
|
|
99
99
|
const websiteName = "spider.cloud";
|
|
100
100
|
const queryParams = { limit: 20, page: 0 };
|
|
101
101
|
spider
|
|
102
|
-
.
|
|
102
|
+
.createSignedUrl(websiteName, queryParams)
|
|
103
103
|
.then((response) => console.log(response))
|
|
104
104
|
.catch((error) => console.error(error));
|
|
105
105
|
```
|
|
@@ -118,7 +118,7 @@ spider
|
|
|
118
118
|
- **`getCredits()`**: Retrieve account's remaining credits.
|
|
119
119
|
- **`getData(table, params)`**: Retrieve data records from the DB.
|
|
120
120
|
- **`deleteData(table, params)`**: Delete records from the DB.
|
|
121
|
-
- **`
|
|
121
|
+
- **`createSignedUrl(domain, params)`**: Download the records from the DB.
|
|
122
122
|
|
|
123
123
|
## Error Handling
|
|
124
124
|
|
package/dist/client.d.ts
CHANGED
|
@@ -108,14 +108,14 @@ export declare class Spider {
|
|
|
108
108
|
*/
|
|
109
109
|
getCrawlState(url: string, params?: GenericParams): Promise<any>;
|
|
110
110
|
/**
|
|
111
|
-
*
|
|
111
|
+
* Create a signed url to download files from the storage.
|
|
112
112
|
* @param {string} [domain] - The domain for the user's storage. If not provided, downloads all files.
|
|
113
113
|
* @param {Object} [options] - The download options.
|
|
114
114
|
* @param {boolean} [raw] - Return the raw response.
|
|
115
115
|
|
|
116
116
|
* @returns {Promise<Response>} The response containing the file stream.
|
|
117
117
|
*/
|
|
118
|
-
|
|
118
|
+
createSignedUrl(domain?: string, options?: {
|
|
119
119
|
page?: number;
|
|
120
120
|
limit?: number;
|
|
121
121
|
expiresIn?: number;
|
package/dist/client.js
CHANGED
|
@@ -161,14 +161,14 @@ class Spider {
|
|
|
161
161
|
return this._apiPost("data/crawl_state", { url: url, ...params });
|
|
162
162
|
}
|
|
163
163
|
/**
|
|
164
|
-
*
|
|
164
|
+
* Create a signed url to download files from the storage.
|
|
165
165
|
* @param {string} [domain] - The domain for the user's storage. If not provided, downloads all files.
|
|
166
166
|
* @param {Object} [options] - The download options.
|
|
167
167
|
* @param {boolean} [raw] - Return the raw response.
|
|
168
168
|
|
|
169
169
|
* @returns {Promise<Response>} The response containing the file stream.
|
|
170
170
|
*/
|
|
171
|
-
async
|
|
171
|
+
async createSignedUrl(domain, options, raw) {
|
|
172
172
|
const { page, limit, expiresIn } = options !== null && options !== void 0 ? options : {};
|
|
173
173
|
const params = new URLSearchParams({
|
|
174
174
|
...(domain && { domain }),
|