diff --git a/README.md b/README.md index dc39ac7..b3f46f3 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,11 @@ Sketch.addPreview('/path/to/preview.png'); newSketch.build('newSketch.sketch'); ``` +### Temporary files + +This library by defaults uses `.sketch-constructor` directory for placing temporary files like Bitmap images or preview. +We provide APIs to change default temporary directory by providing `STORAGE_DIR` environment variable. + ### Read/manipulate an existing Sketch file Getting data from or manipulating an existing Sketch file. diff --git a/utils/paths.js b/utils/paths.js index 8b0b14b..c0667be 100644 --- a/utils/paths.js +++ b/utils/paths.js @@ -12,14 +12,14 @@ */ /** - * Path to the temporary local image folder + * Path to the temporary sketch constructor folder */ -const STORAGE_IMG_DIR = '.sketch-constructor/images'; +const STORAGE_DIR = process.env.STORAGE_DIR || '.sketch-constructor'; /** - * Path to the temporary sketch constructor folder + * Path to the temporary local image folder */ -const STORAGE_DIR = '.sketch-constructor'; +const STORAGE_IMG_DIR = `${STORAGE_DIR}/images`; /** * Path to directory with preview file