picosh 0.1.3 → 0.1.4

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.
Files changed (2) hide show
  1. package/index.js +3 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -7,6 +7,7 @@ const https = require('https');
7
7
  const http = require('http');
8
8
 
9
9
  const SAVE_DIR = path.join(os.tmpdir(), 'picosh');
10
+ const SAVE_PATH = path.join(SAVE_DIR, 'clip_latest.png');
10
11
 
11
12
  function hasImage(clipboard) {
12
13
  if (!clipboard.readImage().isEmpty()) return {type: 'bitmap'};
@@ -20,7 +21,7 @@ function hasImage(clipboard) {
20
21
 
21
22
  function saveBitmap(clipboard) {
22
23
  fs.mkdirSync(SAVE_DIR, {recursive: true});
23
- const filepath = path.join(SAVE_DIR, `clip_${Date.now()}.png`);
24
+ const filepath = SAVE_PATH;
24
25
  fs.writeFileSync(filepath, clipboard.readImage().toPNG());
25
26
  return Promise.resolve(filepath);
26
27
  }
@@ -28,7 +29,7 @@ function saveBitmap(clipboard) {
28
29
  function downloadImage(url) {
29
30
  return new Promise((resolve) => {
30
31
  fs.mkdirSync(SAVE_DIR, {recursive: true});
31
- const filepath = path.join(SAVE_DIR, `clip_${Date.now()}.png`);
32
+ const filepath = SAVE_PATH;
32
33
  const file = fs.createWriteStream(filepath);
33
34
  const client = url.startsWith('https') ? https : http;
34
35
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "picosh",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Hyper plugin: paste clipboard images as file paths",
5
5
  "main": "index.js",
6
6
  "license": "MIT",