@crawlee/memory-storage
Advanced tools
Comparing version 3.0.0 to 3.0.1-beta.0
@@ -9,3 +9,3 @@ import type * as storage from '@crawlee/types'; | ||
* Path to directory where the data will also be saved. | ||
* @default process.env.CRAWLEE_STORAGE_DIR ?? './crawlee_storage' | ||
* @default process.env.CRAWLEE_STORAGE_DIR ?? './storage' | ||
*/ | ||
@@ -12,0 +12,0 @@ localDataDirectory?: string; |
@@ -69,3 +69,12 @@ "use strict"; | ||
}).parse(options); | ||
this.localDataDirectory = options.localDataDirectory ?? process.env.CRAWLEE_STORAGE_DIR ?? './crawlee_storage'; | ||
// v3.0.0 used `crawlee_storage` as the default, we changed this in v3.0.1 to just `storage`, | ||
// this function handles it without making BC breaks - it respects existing `crawlee_storage` | ||
// directories, and uses the `storage` only if it's not there. | ||
const defaultStorageDir = () => { | ||
if ((0, fs_extra_1.pathExistsSync)((0, node_path_1.resolve)('./crawlee_storage'))) { | ||
return './crawlee_storage'; | ||
} | ||
return './storage'; | ||
}; | ||
this.localDataDirectory = options.localDataDirectory ?? process.env.CRAWLEE_STORAGE_DIR ?? defaultStorageDir(); | ||
this.datasetsDirectory = (0, node_path_1.resolve)(this.localDataDirectory, 'datasets'); | ||
@@ -126,3 +135,3 @@ this.keyValueStoresDirectory = (0, node_path_1.resolve)(this.localDataDirectory, 'key_value_stores'); | ||
async removeFiles(folder) { | ||
const storagePathExists = await (0, fs_extra_1.pathExists)(folder); | ||
const storagePathExists = (0, fs_extra_1.pathExistsSync)(folder); | ||
if (storagePathExists) { | ||
@@ -129,0 +138,0 @@ const direntNames = await (0, promises_1.readdir)(folder); |
{ | ||
"name": "@crawlee/memory-storage", | ||
"version": "3.0.0", | ||
"version": "3.0.1-beta.0", | ||
"description": "A simple in-memory storage implementation of the Apify API", | ||
@@ -52,4 +52,4 @@ "engines": { | ||
"@apify/log": "^2.0.0", | ||
"@crawlee/types": "^3.0.0", | ||
"@crawlee/utils": "^3.0.0", | ||
"@crawlee/types": "^3.0.1-beta.0", | ||
"@crawlee/utils": "^3.0.1-beta.0", | ||
"@sapphire/shapeshift": "^3.0.0", | ||
@@ -56,0 +56,0 @@ "content-type": "^1.0.4", |
@@ -13,3 +13,3 @@ <h1 align="center"> | ||
<p align=center> | ||
<a href="https://www.npmjs.com/package/@crawlee/core" rel="nofollow"><img src="https://img.shields.io/npm/v/@crawlee/core/next.svg" alt="NPM dev version" data-canonical-src="https://img.shields.io/npm/v/@crawlee/core/next.svg" style="max-width: 100%;"></a> | ||
<a href="https://www.npmjs.com/package/@crawlee/core" rel="nofollow"><img src="https://img.shields.io/npm/v/@crawlee/core.svg" alt="NPM latest version" data-canonical-src="https://img.shields.io/npm/v/@crawlee/core/next.svg" style="max-width: 100%;"></a> | ||
<a href="https://www.npmjs.com/package/@crawlee/core" rel="nofollow"><img src="https://img.shields.io/npm/dm/@crawlee/core.svg" alt="Downloads" data-canonical-src="https://img.shields.io/npm/dm/@crawlee/core.svg" style="max-width: 100%;"></a> | ||
@@ -104,3 +104,3 @@ <a href="https://discord.gg/jyEM2PRvMU" rel="nofollow"><img src="https://img.shields.io/discord/801163717915574323?label=discord" alt="Chat on discord" data-canonical-src="https://img.shields.io/discord/801163717915574323?label=discord" style="max-width: 100%;"></a> | ||
By default, Crawlee stores data to `./crawlee_storage` in the current working directory. You can override this directory via `CRAWLEE_STORAGE_DIR` env var. For details, see [Environment variables](https://crawlee.dev/docs/guides/environment-variables), [Request storage](https://crawlee.dev/docs/guides/request-storage) and [Result storage](https://crawlee.dev/docs/guides/result-storage). | ||
By default, Crawlee stores data to `./storage` in the current working directory. You can override this directory via `CRAWLEE_STORAGE_DIR` env var. For details, see [Environment variables](https://crawlee.dev/docs/guides/environment-variables), [Request storage](https://crawlee.dev/docs/guides/request-storage) and [Result storage](https://crawlee.dev/docs/guides/result-storage). | ||
@@ -124,3 +124,3 @@ ### Local usage with Crawlee command-line interface (CLI) | ||
By default, the crawling data will be stored in a local directory at `./crawlee_storage`. For example, the input JSON file for the actor is expected to be in the default key-value store in `./crawlee_storage/key_value_stores/default/INPUT.json`. | ||
By default, the crawling data will be stored in a local directory at `./storage`. For example, the input JSON file for the actor is expected to be in the default key-value store in `./storage/key_value_stores/default/INPUT.json`. | ||
@@ -127,0 +127,0 @@ ### Usage on the Apify platform |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
262549
2155
1
Updated@crawlee/types@^3.0.1-beta.0
Updated@crawlee/utils@^3.0.1-beta.0