cacache 9.2.9 → 10.0.2
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/CHANGELOG.md +50 -0
- package/LICENSE.md +15 -2
- package/README.es.md +628 -0
- package/get.js +36 -0
- package/lib/content/read.js +12 -0
- package/lib/entry-index.js +4 -3
- package/lib/util/move-file.js +12 -16
- package/locales/en.js +2 -0
- package/locales/es.js +2 -0
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,56 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
<a name="10.0.2"></a>
|
|
6
|
+
## [10.0.2](https://github.com/zkat/cacache/compare/v10.0.1...v10.0.2) (2018-01-07)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **ls:** deleted entries could cause a premature stream EOF ([347dc36](https://github.com/zkat/cacache/commit/347dc36))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
<a name="10.0.1"></a>
|
|
16
|
+
## [10.0.1](https://github.com/zkat/cacache/compare/v10.0.0...v10.0.1) (2017-11-15)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* **move-file:** actually use the fallback to `move-concurrently` (#110) ([073fbe1](https://github.com/zkat/cacache/commit/073fbe1))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
<a name="10.0.0"></a>
|
|
26
|
+
# [10.0.0](https://github.com/zkat/cacache/compare/v9.3.0...v10.0.0) (2017-10-23)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Features
|
|
30
|
+
|
|
31
|
+
* **license:** relicense to ISC (#111) ([fdbb4e5](https://github.com/zkat/cacache/commit/fdbb4e5))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Performance Improvements
|
|
35
|
+
|
|
36
|
+
* more copyFile benchmarks ([63787bb](https://github.com/zkat/cacache/commit/63787bb))
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### BREAKING CHANGES
|
|
40
|
+
|
|
41
|
+
* **license:** the license has been changed from CC0-1.0 to ISC.
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
<a name="9.3.0"></a>
|
|
46
|
+
# [9.3.0](https://github.com/zkat/cacache/compare/v9.2.9...v9.3.0) (2017-10-07)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
### Features
|
|
50
|
+
|
|
51
|
+
* **copy:** added cacache.get.copy api for fast copies (#107) ([067b5f6](https://github.com/zkat/cacache/commit/067b5f6))
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
5
55
|
<a name="9.2.9"></a>
|
|
6
56
|
## [9.2.9](https://github.com/zkat/cacache/compare/v9.2.8...v9.2.9) (2017-06-17)
|
|
7
57
|
|
package/LICENSE.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
ISC License
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Copyright (c) npm, Inc.
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for
|
|
6
|
+
any purpose with or without fee is hereby granted, provided that the
|
|
7
|
+
above copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE COPYRIGHT HOLDER DISCLAIMS
|
|
10
|
+
ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
|
11
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
|
|
12
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
|
|
13
|
+
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
14
|
+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
|
15
|
+
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
|
|
16
|
+
USE OR PERFORMANCE OF THIS SOFTWARE.
|
package/README.es.md
ADDED
|
@@ -0,0 +1,628 @@
|
|
|
1
|
+
# cacache [](https://npm.im/cacache) [](https://npm.im/cacache) [](https://travis-ci.org/zkat/cacache) [](https://ci.appveyor.com/project/zkat/cacache) [](https://coveralls.io/github/zkat/cacache?branch=latest)
|
|
2
|
+
|
|
3
|
+
[`cacache`](https://github.com/zkat/cacache) es una librería de Node.js para
|
|
4
|
+
manejar caches locales en disco, con acceso tanto con claves únicas como
|
|
5
|
+
direcciones de contenido (hashes/hacheos). Es súper rápida, excelente con el
|
|
6
|
+
acceso concurrente, y jamás te dará datos incorrectos, aún si se corrompen o
|
|
7
|
+
manipulan directamente los ficheros del cache.
|
|
8
|
+
|
|
9
|
+
El propósito original era reemplazar el caché local de
|
|
10
|
+
[npm](https://npm.im/npm), pero se puede usar por su propia cuenta.
|
|
11
|
+
|
|
12
|
+
_Traducciones: [English](README.md)_
|
|
13
|
+
|
|
14
|
+
## Instalación
|
|
15
|
+
|
|
16
|
+
`$ npm install --save cacache`
|
|
17
|
+
|
|
18
|
+
## Índice
|
|
19
|
+
|
|
20
|
+
* [Ejemplo](#ejemplo)
|
|
21
|
+
* [Características](#características)
|
|
22
|
+
* [Cómo Contribuir](#cómo-contribuir)
|
|
23
|
+
* [API](#api)
|
|
24
|
+
* [Usando el API en español](#localized-api)
|
|
25
|
+
* Leer
|
|
26
|
+
* [`ls`](#ls)
|
|
27
|
+
* [`ls.flujo`](#ls-stream)
|
|
28
|
+
* [`saca`](#get-data)
|
|
29
|
+
* [`saca.flujo`](#get-stream)
|
|
30
|
+
* [`saca.info`](#get-info)
|
|
31
|
+
* [`saca.tieneDatos`](#get-hasContent)
|
|
32
|
+
* Escribir
|
|
33
|
+
* [`mete`](#put-data)
|
|
34
|
+
* [`mete.flujo`](#put-stream)
|
|
35
|
+
* [opciones para `mete*`](#put-options)
|
|
36
|
+
* [`rm.todo`](#rm-all)
|
|
37
|
+
* [`rm.entrada`](#rm-entry)
|
|
38
|
+
* [`rm.datos`](#rm-content)
|
|
39
|
+
* Utilidades
|
|
40
|
+
* [`ponLenguaje`](#set-locale)
|
|
41
|
+
* [`limpiaMemoizado`](#clear-memoized)
|
|
42
|
+
* [`tmp.hazdir`](#tmp-mkdir)
|
|
43
|
+
* [`tmp.conTmp`](#with-tmp)
|
|
44
|
+
* Integridad
|
|
45
|
+
* [Subresource Integrity](#integrity)
|
|
46
|
+
* [`verifica`](#verify)
|
|
47
|
+
* [`verifica.ultimaVez`](#verify-last-run)
|
|
48
|
+
|
|
49
|
+
### Ejemplo
|
|
50
|
+
|
|
51
|
+
```javascript
|
|
52
|
+
const cacache = require('cacache/es')
|
|
53
|
+
const fs = require('fs')
|
|
54
|
+
|
|
55
|
+
const tarbol = '/ruta/a/mi-tar.tgz'
|
|
56
|
+
const rutaCache = '/tmp/my-toy-cache'
|
|
57
|
+
const clave = 'mi-clave-única-1234'
|
|
58
|
+
|
|
59
|
+
// ¡Añádelo al caché! Usa `rutaCache` como raíz del caché.
|
|
60
|
+
cacache.mete(rutaCache, clave, '10293801983029384').then(integrity => {
|
|
61
|
+
console.log(`Saved content to ${rutaCache}.`)
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
const destino = '/tmp/mytar.tgz'
|
|
65
|
+
|
|
66
|
+
// Copia el contenido del caché a otro fichero, pero esta vez con flujos.
|
|
67
|
+
cacache.saca.flujo(
|
|
68
|
+
rutaCache, clave
|
|
69
|
+
).pipe(
|
|
70
|
+
fs.createWriteStream(destino)
|
|
71
|
+
).on('finish', () => {
|
|
72
|
+
console.log('extracción completada')
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
// La misma cosa, pero accesando el contenido directamente, sin tocar el índice.
|
|
76
|
+
cacache.saca.porHacheo(rutaCache, integridad).then(datos => {
|
|
77
|
+
fs.writeFile(destino, datos, err => {
|
|
78
|
+
console.log('datos del tarbol sacados basado en su sha512, y escrito a otro fichero')
|
|
79
|
+
})
|
|
80
|
+
})
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Características
|
|
84
|
+
|
|
85
|
+
* Extracción por clave o por dirección de contenido (shasum, etc)
|
|
86
|
+
* Usa el estándard de web, [Subresource Integrity](#integrity)
|
|
87
|
+
* Compatible con multiples algoritmos - usa sha1, sha512, etc, en el mismo caché sin problema
|
|
88
|
+
* Entradas con contenido idéntico comparten ficheros
|
|
89
|
+
* Tolerancia de fallas (inmune a corrupción, ficheros parciales, carreras de proceso, etc)
|
|
90
|
+
* Verificación completa de datos cuando (escribiendo y leyendo)
|
|
91
|
+
* Concurrencia rápida, segura y "lockless"
|
|
92
|
+
* Compatible con `stream`s (flujos)
|
|
93
|
+
* Compatible con `Promise`s (promesas)
|
|
94
|
+
* Bastante rápida -- acceso, incluyendo verificación, en microsegundos
|
|
95
|
+
* Almacenaje de metadatos arbitrarios
|
|
96
|
+
* Colección de basura y verificación adicional fuera de banda
|
|
97
|
+
* Cobertura rigurosa de pruebas
|
|
98
|
+
* Probablente hay un "Bloom filter" por ahí en algún lado. Eso le mola a la gente, ¿Verdad? 🤔
|
|
99
|
+
|
|
100
|
+
### Cómo Contribuir
|
|
101
|
+
|
|
102
|
+
El equipo de cacache felizmente acepta contribuciones de código y otras maneras de participación. ¡Hay muchas formas diferentes de contribuir! La [Guía de Colaboradores](CONTRIBUTING.md) (en inglés) tiene toda la información que necesitas para cualquier tipo de contribución: todo desde cómo reportar errores hasta cómo someter parches con nuevas características. Con todo y eso, no se preocupe por si lo que haces está exáctamente correcto: no hay ningún problema en hacer preguntas si algo no está claro, o no lo encuentras.
|
|
103
|
+
|
|
104
|
+
El equipo de cacache tiene miembros hispanohablantes: es completamente aceptable crear `issues` y `pull requests` en español/castellano.
|
|
105
|
+
|
|
106
|
+
Todos los participantes en este proyecto deben obedecer el [Código de Conducta](CODE_OF_CONDUCT.md) (en inglés), y en general actuar de forma amable y respetuosa mientras participan en esta comunidad.
|
|
107
|
+
|
|
108
|
+
Por favor refiérase al [Historial de Cambios](CHANGELOG.md) (en inglés) para detalles sobre cambios importantes incluídos en cada versión.
|
|
109
|
+
|
|
110
|
+
Finalmente, cacache tiene un sistema de localización de lenguaje. Si te interesa añadir lenguajes o mejorar los que existen, mira en el directorio `./locales` para comenzar.
|
|
111
|
+
|
|
112
|
+
Happy hacking!
|
|
113
|
+
|
|
114
|
+
### API
|
|
115
|
+
|
|
116
|
+
#### <a name="localized-api"></a> Usando el API en español
|
|
117
|
+
|
|
118
|
+
cacache incluye una traducción completa de su API al castellano, con las mismas
|
|
119
|
+
características. Para usar el API como está documentado en este documento, usa
|
|
120
|
+
`require('cacache/es')`
|
|
121
|
+
|
|
122
|
+
cacache también tiene otros lenguajes: encuéntralos bajo `./locales`, y podrás
|
|
123
|
+
usar el API en ese lenguaje con `require('cacache/<lenguaje>')`
|
|
124
|
+
|
|
125
|
+
#### <a name="ls"></a> `> cacache.ls(cache) -> Promise<Object>`
|
|
126
|
+
|
|
127
|
+
Enumera todas las entradas en el caché, dentro de un solo objeto. Cada entrada
|
|
128
|
+
en el objeto tendrá como clave la clave única usada para el índice, el valor
|
|
129
|
+
siendo un objeto de [`saca.info`](#get-info).
|
|
130
|
+
|
|
131
|
+
##### Ejemplo
|
|
132
|
+
|
|
133
|
+
```javascript
|
|
134
|
+
cacache.ls(rutaCache).then(console.log)
|
|
135
|
+
// Salida
|
|
136
|
+
{
|
|
137
|
+
'my-thing': {
|
|
138
|
+
key: 'my-thing',
|
|
139
|
+
integrity: 'sha512-BaSe64/EnCoDED+HAsh=='
|
|
140
|
+
path: '.testcache/content/deadbeef', // unido con `rutaCache`
|
|
141
|
+
time: 12345698490,
|
|
142
|
+
size: 4023948,
|
|
143
|
+
metadata: {
|
|
144
|
+
name: 'blah',
|
|
145
|
+
version: '1.2.3',
|
|
146
|
+
description: 'this was once a package but now it is my-thing'
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
'other-thing': {
|
|
150
|
+
key: 'other-thing',
|
|
151
|
+
integrity: 'sha1-ANothER+hasH=',
|
|
152
|
+
path: '.testcache/content/bada55',
|
|
153
|
+
time: 11992309289,
|
|
154
|
+
size: 111112
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
#### <a name="ls-stream"></a> `> cacache.ls.flujo(cache) -> Readable`
|
|
160
|
+
|
|
161
|
+
Enumera todas las entradas en el caché, emitiendo un objeto de
|
|
162
|
+
[`saca.info`](#get-info) por cada evento de `data` en el flujo.
|
|
163
|
+
|
|
164
|
+
##### Ejemplo
|
|
165
|
+
|
|
166
|
+
```javascript
|
|
167
|
+
cacache.ls.flujo(rutaCache).on('data', console.log)
|
|
168
|
+
// Salida
|
|
169
|
+
{
|
|
170
|
+
key: 'my-thing',
|
|
171
|
+
integrity: 'sha512-BaSe64HaSh',
|
|
172
|
+
path: '.testcache/content/deadbeef', // unido con `rutaCache`
|
|
173
|
+
time: 12345698490,
|
|
174
|
+
size: 13423,
|
|
175
|
+
metadata: {
|
|
176
|
+
name: 'blah',
|
|
177
|
+
version: '1.2.3',
|
|
178
|
+
description: 'this was once a package but now it is my-thing'
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
{
|
|
183
|
+
key: 'other-thing',
|
|
184
|
+
integrity: 'whirlpool-WoWSoMuchSupport',
|
|
185
|
+
path: '.testcache/content/bada55',
|
|
186
|
+
time: 11992309289,
|
|
187
|
+
size: 498023984029
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
{
|
|
191
|
+
...
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
#### <a name="get-data"></a> `> cacache.saca(cache, clave, [ops]) -> Promise({data, metadata, integrity})`
|
|
196
|
+
|
|
197
|
+
Devuelve un objeto con los datos, hacheo de integridad y metadatos identificados
|
|
198
|
+
por la `clave`. La propiedad `data` de este objeto será una instancia de
|
|
199
|
+
`Buffer` con los datos almacenados en el caché. to do with it! cacache just
|
|
200
|
+
won't care.
|
|
201
|
+
|
|
202
|
+
`integrity` es un `string` de [Subresource Integrity](#integrity). Dígase, un
|
|
203
|
+
`string` que puede ser usado para verificar a la `data`, que tiene como formato
|
|
204
|
+
`<algoritmo>-<hacheo-integridad-base64>`.
|
|
205
|
+
|
|
206
|
+
So no existe ninguna entrada identificada por `clave`, o se los datos
|
|
207
|
+
almacenados localmente fallan verificación, el `Promise` fallará.
|
|
208
|
+
|
|
209
|
+
Una sub-función, `saca.porHacheo`, tiene casi el mismo comportamiento, excepto
|
|
210
|
+
que busca entradas usando el hacheo de integridad, sin tocar el índice general.
|
|
211
|
+
Esta versión *sólo* devuelve `data`, sin ningún objeto conteniéndola.
|
|
212
|
+
|
|
213
|
+
##### Nota
|
|
214
|
+
|
|
215
|
+
Esta función lee la entrada completa a la memoria antes de devolverla. Si estás
|
|
216
|
+
almacenando datos Muy Grandes, es posible que [`saca.flujo`](#get-stream) sea
|
|
217
|
+
una mejor solución.
|
|
218
|
+
|
|
219
|
+
##### Ejemplo
|
|
220
|
+
|
|
221
|
+
```javascript
|
|
222
|
+
// Busca por clave
|
|
223
|
+
cache.saca(rutaCache, 'my-thing').then(console.log)
|
|
224
|
+
// Salida:
|
|
225
|
+
{
|
|
226
|
+
metadata: {
|
|
227
|
+
thingName: 'my'
|
|
228
|
+
},
|
|
229
|
+
integrity: 'sha512-BaSe64HaSh',
|
|
230
|
+
data: Buffer#<deadbeef>,
|
|
231
|
+
size: 9320
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// Busca por hacheo
|
|
235
|
+
cache.saca.porHacheo(rutaCache, 'sha512-BaSe64HaSh').then(console.log)
|
|
236
|
+
// Salida:
|
|
237
|
+
Buffer#<deadbeef>
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
#### <a name="get-stream"></a> `> cacache.saca.flujo(cache, clave, [ops]) -> Readable`
|
|
241
|
+
|
|
242
|
+
Devuelve un [Readable
|
|
243
|
+
Stream](https://nodejs.org/api/stream.html#stream_readable_streams) de los datos
|
|
244
|
+
almacenados bajo `clave`.
|
|
245
|
+
|
|
246
|
+
So no existe ninguna entrada identificada por `clave`, o se los datos
|
|
247
|
+
almacenados localmente fallan verificación, el `Promise` fallará.
|
|
248
|
+
|
|
249
|
+
`metadata` y `integrity` serán emitidos como eventos antes de que el flujo
|
|
250
|
+
cierre.
|
|
251
|
+
|
|
252
|
+
Una sub-función, `saca.flujo.porHacheo`, tiene casi el mismo comportamiento,
|
|
253
|
+
excepto que busca entradas usando el hacheo de integridad, sin tocar el índice
|
|
254
|
+
general. Esta versión no emite eventos de `metadata` o `integrity`.
|
|
255
|
+
|
|
256
|
+
##### Ejemplo
|
|
257
|
+
|
|
258
|
+
```javascript
|
|
259
|
+
// Busca por clave
|
|
260
|
+
cache.saca.flujo(
|
|
261
|
+
rutaCache, 'my-thing'
|
|
262
|
+
).on('metadata', metadata => {
|
|
263
|
+
console.log('metadata:', metadata)
|
|
264
|
+
}).on('integrity', integrity => {
|
|
265
|
+
console.log('integrity:', integrity)
|
|
266
|
+
}).pipe(
|
|
267
|
+
fs.createWriteStream('./x.tgz')
|
|
268
|
+
)
|
|
269
|
+
// Salidas:
|
|
270
|
+
metadata: { ... }
|
|
271
|
+
integrity: 'sha512-SoMeDIGest+64=='
|
|
272
|
+
|
|
273
|
+
// Busca por hacheo
|
|
274
|
+
cache.saca.flujo.porHacheo(
|
|
275
|
+
rutaCache, 'sha512-SoMeDIGest+64=='
|
|
276
|
+
).pipe(
|
|
277
|
+
fs.createWriteStream('./x.tgz')
|
|
278
|
+
)
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
#### <a name="get-info"></a> `> cacache.saca.info(cache, clave) -> Promise`
|
|
282
|
+
|
|
283
|
+
Busca la `clave` en el índice del caché, devolviendo información sobre la
|
|
284
|
+
entrada si existe.
|
|
285
|
+
|
|
286
|
+
##### Campos
|
|
287
|
+
|
|
288
|
+
* `key` - Clave de la entrada. Igual al argumento `clave`.
|
|
289
|
+
* `integrity` - [hacheo de Subresource Integrity](#integrity) del contenido al que se refiere esta entrada.
|
|
290
|
+
* `path` - Dirección del fichero de datos almacenados, relativa al argumento `cache`.
|
|
291
|
+
* `time` - Hora de creación de la entrada
|
|
292
|
+
* `metadata` - Metadatos asignados a esta entrada por el usuario
|
|
293
|
+
|
|
294
|
+
##### Ejemplo
|
|
295
|
+
|
|
296
|
+
```javascript
|
|
297
|
+
cacache.saca.info(rutaCache, 'my-thing').then(console.log)
|
|
298
|
+
|
|
299
|
+
// Salida
|
|
300
|
+
{
|
|
301
|
+
key: 'my-thing',
|
|
302
|
+
integrity: 'sha256-MUSTVERIFY+ALL/THINGS=='
|
|
303
|
+
path: '.testcache/content/deadbeef',
|
|
304
|
+
time: 12345698490,
|
|
305
|
+
size: 849234,
|
|
306
|
+
metadata: {
|
|
307
|
+
name: 'blah',
|
|
308
|
+
version: '1.2.3',
|
|
309
|
+
description: 'this was once a package but now it is my-thing'
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
#### <a name="get-hasContent"></a> `> cacache.saca.tieneDatos(cache, integrity) -> Promise`
|
|
315
|
+
|
|
316
|
+
Busca un [hacheo Subresource Integrity](#integrity) en el caché. Si existe el
|
|
317
|
+
contenido asociado con `integrity`, devuelve un objeto con dos campos: el hacheo
|
|
318
|
+
_específico_ que se usó para la búsqueda, `sri`, y el tamaño total del
|
|
319
|
+
contenido, `size`. Si no existe ningún contenido asociado con `integrity`,
|
|
320
|
+
devuelve `false`.
|
|
321
|
+
|
|
322
|
+
##### Ejemplo
|
|
323
|
+
|
|
324
|
+
```javascript
|
|
325
|
+
cacache.saca.tieneDatos(rutaCache, 'sha256-MUSTVERIFY+ALL/THINGS==').then(console.log)
|
|
326
|
+
|
|
327
|
+
// Salida
|
|
328
|
+
{
|
|
329
|
+
sri: {
|
|
330
|
+
source: 'sha256-MUSTVERIFY+ALL/THINGS==',
|
|
331
|
+
algorithm: 'sha256',
|
|
332
|
+
digest: 'MUSTVERIFY+ALL/THINGS==',
|
|
333
|
+
options: []
|
|
334
|
+
},
|
|
335
|
+
size: 9001
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
cacache.saca.tieneDatos(rutaCache, 'sha521-NOT+IN/CACHE==').then(console.log)
|
|
339
|
+
|
|
340
|
+
// Salida
|
|
341
|
+
false
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
#### <a name="put-data"></a> `> cacache.mete(cache, clave, datos, [ops]) -> Promise`
|
|
345
|
+
|
|
346
|
+
Inserta `datos` en el caché. El `Promise` devuelto se resuelve con un hacheo
|
|
347
|
+
(generado conforme a [`ops.algorithms`](#optsalgorithms)) después que la entrada
|
|
348
|
+
haya sido escrita en completo.
|
|
349
|
+
|
|
350
|
+
##### Ejemplo
|
|
351
|
+
|
|
352
|
+
```javascript
|
|
353
|
+
fetch(
|
|
354
|
+
'https://registry.npmjs.org/cacache/-/cacache-1.0.0.tgz'
|
|
355
|
+
).then(datos => {
|
|
356
|
+
return cacache.mete(rutaCache, 'registry.npmjs.org|cacache@1.0.0', datos)
|
|
357
|
+
}).then(integridad => {
|
|
358
|
+
console.log('el hacheo de integridad es', integridad)
|
|
359
|
+
})
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
#### <a name="put-stream"></a> `> cacache.mete.flujo(cache, clave, [ops]) -> Writable`
|
|
363
|
+
|
|
364
|
+
Devuelve un [Writable
|
|
365
|
+
Stream](https://nodejs.org/api/stream.html#stream_writable_streams) que inserta
|
|
366
|
+
al caché los datos escritos a él. Emite un evento `integrity` con el hacheo del
|
|
367
|
+
contenido escrito, cuando completa.
|
|
368
|
+
|
|
369
|
+
##### Ejemplo
|
|
370
|
+
|
|
371
|
+
```javascript
|
|
372
|
+
request.get(
|
|
373
|
+
'https://registry.npmjs.org/cacache/-/cacache-1.0.0.tgz'
|
|
374
|
+
).pipe(
|
|
375
|
+
cacache.mete.flujo(
|
|
376
|
+
rutaCache, 'registry.npmjs.org|cacache@1.0.0'
|
|
377
|
+
).on('integrity', d => console.log(`integrity digest is ${d}`))
|
|
378
|
+
)
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
#### <a name="put-options"></a> `> opciones para cacache.mete`
|
|
382
|
+
|
|
383
|
+
La funciones `cacache.mete` tienen un número de opciones en común.
|
|
384
|
+
|
|
385
|
+
##### `ops.metadata`
|
|
386
|
+
|
|
387
|
+
Metadatos del usuario que se almacenarán con la entrada.
|
|
388
|
+
|
|
389
|
+
##### `ops.size`
|
|
390
|
+
|
|
391
|
+
El tamaño declarado de los datos que se van a insertar. Si es proveído, cacache
|
|
392
|
+
verificará que los datos escritos sean de ese tamaño, o si no, fallará con un
|
|
393
|
+
error con código `EBADSIZE`.
|
|
394
|
+
|
|
395
|
+
##### `ops.integrity`
|
|
396
|
+
|
|
397
|
+
El hacheo de integridad de los datos siendo escritos.
|
|
398
|
+
|
|
399
|
+
Si es proveído, y los datos escritos no le corresponden, la operación fallará
|
|
400
|
+
con un error con código `EINTEGRITY`.
|
|
401
|
+
|
|
402
|
+
`ops.algorithms` no tiene ningún efecto si esta opción está presente.
|
|
403
|
+
|
|
404
|
+
##### `ops.algorithms`
|
|
405
|
+
|
|
406
|
+
Por Defecto: `['sha512']`
|
|
407
|
+
|
|
408
|
+
Algoritmos que se deben usar cuando se calcule el hacheo de [subresource
|
|
409
|
+
integrity](#integrity) para los datos insertados. Puede usar cualquier algoritmo
|
|
410
|
+
enumerado en `crypto.getHashes()`.
|
|
411
|
+
|
|
412
|
+
Por el momento, sólo se acepta un algoritmo (dígase, un array con exáctamente un
|
|
413
|
+
valor). No tiene ningún efecto si `ops.integrity` también ha sido proveido.
|
|
414
|
+
|
|
415
|
+
##### `ops.uid`/`ops.gid`
|
|
416
|
+
|
|
417
|
+
Si están presentes, cacache hará todo lo posible para asegurarse que todos los
|
|
418
|
+
ficheros creados en el proceso de sus operaciones en el caché usen esta
|
|
419
|
+
combinación en particular.
|
|
420
|
+
|
|
421
|
+
##### `ops.memoize`
|
|
422
|
+
|
|
423
|
+
Por Defecto: `null`
|
|
424
|
+
|
|
425
|
+
Si es verdad, cacache tratará de memoizar los datos de la entrada en memoria. La
|
|
426
|
+
próxima vez que el proceso corriente trate de accesar los datos o entrada,
|
|
427
|
+
cacache buscará en memoria antes de buscar en disco.
|
|
428
|
+
|
|
429
|
+
Si `ops.memoize` es un objeto regular o un objeto como `Map` (es decir, un
|
|
430
|
+
objeto con métodos `get()` y `set()`), este objeto en sí sera usado en vez del
|
|
431
|
+
caché de memoria global. Esto permite tener lógica específica a tu aplicación
|
|
432
|
+
encuanto al almacenaje en memoria de tus datos.
|
|
433
|
+
|
|
434
|
+
Si quieres asegurarte que los datos se lean del disco en vez de memoria, usa
|
|
435
|
+
`memoize: false` cuando uses funciones de `cacache.saca`.
|
|
436
|
+
|
|
437
|
+
#### <a name="rm-all"></a> `> cacache.rm.todo(cache) -> Promise`
|
|
438
|
+
|
|
439
|
+
Borra el caché completo, incluyendo ficheros temporeros, ficheros de datos, y el
|
|
440
|
+
índice del caché.
|
|
441
|
+
|
|
442
|
+
##### Ejemplo
|
|
443
|
+
|
|
444
|
+
```javascript
|
|
445
|
+
cacache.rm.todo(rutaCache).then(() => {
|
|
446
|
+
console.log('THE APOCALYPSE IS UPON US 😱')
|
|
447
|
+
})
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
#### <a name="rm-entry"></a> `> cacache.rm.entrada(cache, clave) -> Promise`
|
|
451
|
+
|
|
452
|
+
Alias: `cacache.rm`
|
|
453
|
+
|
|
454
|
+
Borra la entrada `clave` del índuce. El contenido asociado con esta entrada
|
|
455
|
+
seguirá siendo accesible por hacheo usando
|
|
456
|
+
[`saca.flujo.porHacheo`](#get-stream).
|
|
457
|
+
|
|
458
|
+
Para borrar el contenido en sí, usa [`rm.datos`](#rm-content). Si quieres hacer
|
|
459
|
+
esto de manera más segura (pues ficheros de contenido pueden ser usados por
|
|
460
|
+
multiples entradas), usa [`verifica`](#verify) para borrar huérfanos.
|
|
461
|
+
|
|
462
|
+
##### Ejemplo
|
|
463
|
+
|
|
464
|
+
```javascript
|
|
465
|
+
cacache.rm.entrada(rutaCache, 'my-thing').then(() => {
|
|
466
|
+
console.log('I did not like it anyway')
|
|
467
|
+
})
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
#### <a name="rm-content"></a> `> cacache.rm.datos(cache, integrity) -> Promise`
|
|
471
|
+
|
|
472
|
+
Borra el contenido identificado por `integrity`. Cualquier entrada que se
|
|
473
|
+
refiera a este contenido quedarán huérfanas y se invalidarán si se tratan de
|
|
474
|
+
accesar, al menos que contenido idéntico sea añadido bajo `integrity`.
|
|
475
|
+
|
|
476
|
+
##### Ejemplo
|
|
477
|
+
|
|
478
|
+
```javascript
|
|
479
|
+
cacache.rm.datos(rutaCache, 'sha512-SoMeDIGest/IN+BaSE64==').then(() => {
|
|
480
|
+
console.log('los datos para `mi-cosa` se borraron')
|
|
481
|
+
})
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
#### <a name="set-locale"></a> `> cacache.ponLenguaje(locale)`
|
|
485
|
+
|
|
486
|
+
Configura el lenguaje usado para mensajes y errores de cacache. La lista de
|
|
487
|
+
lenguajes disponibles está en el directorio `./locales` del proyecto.
|
|
488
|
+
|
|
489
|
+
_Te interesa añadir más lenguajes? [Somete un PR](CONTRIBUTING.md)!_
|
|
490
|
+
|
|
491
|
+
#### <a name="clear-memoized"></a> `> cacache.limpiaMemoizado()`
|
|
492
|
+
|
|
493
|
+
Completamente reinicializa el caché de memoria interno. Si estás usando tu
|
|
494
|
+
propio objecto con `ops.memoize`, debes hacer esto de manera específica a él.
|
|
495
|
+
|
|
496
|
+
#### <a name="tmp-mkdir"></a> `> tmp.hazdir(cache, ops) -> Promise<Path>`
|
|
497
|
+
|
|
498
|
+
Alias: `tmp.mkdir`
|
|
499
|
+
|
|
500
|
+
Devuelve un directorio único dentro del directorio `tmp` del caché.
|
|
501
|
+
|
|
502
|
+
Una vez tengas el directorio, es responsabilidad tuya asegurarte que todos los
|
|
503
|
+
ficheros escrito a él sean creados usando los permisos y `uid`/`gid` concordante
|
|
504
|
+
con el caché. Si no, puedes pedirle a cacache que lo haga llamando a
|
|
505
|
+
[`cacache.tmp.fix()`](#tmp-fix). Esta función arreglará todos los permisos en el
|
|
506
|
+
directorio tmp.
|
|
507
|
+
|
|
508
|
+
Si quieres que cacache limpie el directorio automáticamente cuando termines, usa
|
|
509
|
+
[`cacache.tmp.conTmp()`](#with-tpm).
|
|
510
|
+
|
|
511
|
+
##### Ejemplo
|
|
512
|
+
|
|
513
|
+
```javascript
|
|
514
|
+
cacache.tmp.mkdir(cache).then(dir => {
|
|
515
|
+
fs.writeFile(path.join(dir, 'blablabla'), Buffer#<1234>, ...)
|
|
516
|
+
})
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
#### <a name="with-tmp"></a> `> tmp.conTmp(cache, ops, cb) -> Promise`
|
|
520
|
+
|
|
521
|
+
Crea un directorio temporero con [`tmp.mkdir()`](#tmp-mkdir) y ejecuta `cb` con
|
|
522
|
+
él como primer argumento. El directorio creado será removido automáticamente
|
|
523
|
+
cuando el valor devolvido por `cb()` se resuelva.
|
|
524
|
+
|
|
525
|
+
Las mismas advertencias aplican en cuanto a manejando permisos para los ficheros
|
|
526
|
+
dentro del directorio.
|
|
527
|
+
|
|
528
|
+
##### Ejemplo
|
|
529
|
+
|
|
530
|
+
```javascript
|
|
531
|
+
cacache.tmp.conTmp(cache, dir => {
|
|
532
|
+
return fs.writeFileAsync(path.join(dir, 'blablabla'), Buffer#<1234>, ...)
|
|
533
|
+
}).then(() => {
|
|
534
|
+
// `dir` no longer exists
|
|
535
|
+
})
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
#### <a name="integrity"></a> Hacheos de Subresource Integrity
|
|
539
|
+
|
|
540
|
+
cacache usa strings que siguen la especificación de [Subresource Integrity
|
|
541
|
+
spec](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity).
|
|
542
|
+
|
|
543
|
+
Es decir, donde quiera cacache espera un argumento o opción `integrity`, ese
|
|
544
|
+
string debería usar el formato `<algoritmo>-<hacheo-base64>`.
|
|
545
|
+
|
|
546
|
+
Una variación importante sobre los hacheos que cacache acepta es que acepta el
|
|
547
|
+
nombre de cualquier algoritmo aceptado por el proceso de Node.js donde se usa.
|
|
548
|
+
Puedes usar `crypto.getHashes()` para ver cuales están disponibles.
|
|
549
|
+
|
|
550
|
+
##### Generando tus propios hacheos
|
|
551
|
+
|
|
552
|
+
Si tienes un `shasum`, en general va a estar en formato de string hexadecimal
|
|
553
|
+
(es decir, un `sha1` se vería como algo así:
|
|
554
|
+
`5f5513f8822fdbe5145af33b64d8d970dcf95c6e`).
|
|
555
|
+
|
|
556
|
+
Para ser compatible con cacache, necesitas convertir esto a su equivalente en
|
|
557
|
+
subresource integrity. Por ejemplo, el hacheo correspondiente al ejemplo
|
|
558
|
+
anterior sería: `sha1-X1UT+IIv2+UUWvM7ZNjZcNz5XG4=`.
|
|
559
|
+
|
|
560
|
+
Puedes usar código así para generarlo por tu cuenta:
|
|
561
|
+
|
|
562
|
+
```javascript
|
|
563
|
+
const crypto = require('crypto')
|
|
564
|
+
const algoritmo = 'sha512'
|
|
565
|
+
const datos = 'foobarbaz'
|
|
566
|
+
|
|
567
|
+
const integrity = (
|
|
568
|
+
algorithm +
|
|
569
|
+
'-' +
|
|
570
|
+
crypto.createHash(algoritmo).update(datos).digest('base64')
|
|
571
|
+
)
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
También puedes usar [`ssri`](https://npm.im/ssri) para deferir el trabajo a otra
|
|
575
|
+
librería que garantiza que todo esté correcto, pues maneja probablemente todas
|
|
576
|
+
las operaciones que tendrías que hacer con SRIs, incluyendo convirtiendo entre
|
|
577
|
+
hexadecimal y el formato SRI.
|
|
578
|
+
|
|
579
|
+
#### <a name="verify"></a> `> cacache.verifica(cache, ops) -> Promise`
|
|
580
|
+
|
|
581
|
+
Examina y arregla tu caché:
|
|
582
|
+
|
|
583
|
+
* Limpia entradas inválidas, huérfanas y corrompidas
|
|
584
|
+
* Te deja filtrar cuales entradas retener, con tu propio filtro
|
|
585
|
+
* Reclama cualquier ficheros de contenido sin referencias en el índice
|
|
586
|
+
* Verifica integridad de todos los ficheros de contenido y remueve los malos
|
|
587
|
+
* Arregla permisos del caché
|
|
588
|
+
* Remieve el directorio `tmp` en el caché, y todo su contenido.
|
|
589
|
+
|
|
590
|
+
Cuando termine, devuelve un objeto con varias estadísticas sobre el proceso de
|
|
591
|
+
verificación, por ejemplo la cantidad de espacio de disco reclamado, el número
|
|
592
|
+
de entradas válidas, número de entradas removidas, etc.
|
|
593
|
+
|
|
594
|
+
##### Opciones
|
|
595
|
+
|
|
596
|
+
* `ops.uid` - uid para asignarle al caché y su contenido
|
|
597
|
+
* `ops.gid` - gid para asignarle al caché y su contenido
|
|
598
|
+
* `ops.filter` - recibe una entrada como argumento. Devuelve falso para removerla. Nota: es posible que esta función sea invocada con la misma entrada más de una vez.
|
|
599
|
+
|
|
600
|
+
##### Example
|
|
601
|
+
|
|
602
|
+
```sh
|
|
603
|
+
echo somegarbage >> $RUTACACHE/content/deadbeef
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
```javascript
|
|
607
|
+
cacache.verifica(rutaCache).then(stats => {
|
|
608
|
+
// deadbeef collected, because of invalid checksum.
|
|
609
|
+
console.log('cache is much nicer now! stats:', stats)
|
|
610
|
+
})
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
#### <a name="verify-last-run"></a> `> cacache.verifica.ultimaVez(cache) -> Promise`
|
|
614
|
+
|
|
615
|
+
Alias: `últimaVez`
|
|
616
|
+
|
|
617
|
+
Devuelve un `Date` que representa la última vez que `cacache.verifica` fue
|
|
618
|
+
ejecutada en `cache`.
|
|
619
|
+
|
|
620
|
+
##### Example
|
|
621
|
+
|
|
622
|
+
```javascript
|
|
623
|
+
cacache.verifica(rutaCache).then(() => {
|
|
624
|
+
cacache.verifica.ultimaVez(rutaCache).then(última => {
|
|
625
|
+
console.log('La última vez que se usó cacache.verifica() fue ' + última)
|
|
626
|
+
})
|
|
627
|
+
})
|
|
628
|
+
```
|
package/get.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const BB = require('bluebird')
|
|
4
4
|
|
|
5
|
+
const fs = require('fs')
|
|
5
6
|
const index = require('./lib/entry-index')
|
|
6
7
|
const memo = require('./lib/memoization')
|
|
7
8
|
const pipe = require('mississippi').pipe
|
|
@@ -152,3 +153,38 @@ function info (cache, key, opts) {
|
|
|
152
153
|
}
|
|
153
154
|
|
|
154
155
|
module.exports.hasContent = read.hasContent
|
|
156
|
+
|
|
157
|
+
module.exports.copy = function cp (cache, key, dest, opts) {
|
|
158
|
+
return copy(false, cache, key, dest, opts)
|
|
159
|
+
}
|
|
160
|
+
module.exports.copy.byDigest = function cpDigest (cache, digest, dest, opts) {
|
|
161
|
+
return copy(true, cache, digest, dest, opts)
|
|
162
|
+
}
|
|
163
|
+
function copy (byDigest, cache, key, dest, opts) {
|
|
164
|
+
opts = opts || {}
|
|
165
|
+
if (read.copy) {
|
|
166
|
+
return (
|
|
167
|
+
byDigest ? BB.resolve(null) : index.find(cache, key, opts)
|
|
168
|
+
).then(entry => {
|
|
169
|
+
if (!entry && !byDigest) {
|
|
170
|
+
throw new index.NotFoundError(cache, key)
|
|
171
|
+
}
|
|
172
|
+
return read.copy(
|
|
173
|
+
cache, byDigest ? key : entry.integrity, dest, opts
|
|
174
|
+
).then(() => byDigest ? key : {
|
|
175
|
+
metadata: entry.metadata,
|
|
176
|
+
size: entry.size,
|
|
177
|
+
integrity: entry.integrity
|
|
178
|
+
})
|
|
179
|
+
})
|
|
180
|
+
} else {
|
|
181
|
+
return getData(byDigest, cache, key, opts).then(res => {
|
|
182
|
+
return fs.writeFileAsync(dest, byDigest ? res : res.data)
|
|
183
|
+
.then(() => byDigest ? key : {
|
|
184
|
+
metadata: res.metadata,
|
|
185
|
+
size: res.size,
|
|
186
|
+
integrity: res.integrity
|
|
187
|
+
})
|
|
188
|
+
})
|
|
189
|
+
}
|
|
190
|
+
}
|
package/lib/content/read.js
CHANGED
|
@@ -52,6 +52,18 @@ function readStream (cache, integrity, opts) {
|
|
|
52
52
|
return stream
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
if (fs.copyFile) {
|
|
56
|
+
module.exports.copy = copy
|
|
57
|
+
}
|
|
58
|
+
function copy (cache, integrity, dest, opts) {
|
|
59
|
+
opts = opts || {}
|
|
60
|
+
return pickContentSri(cache, integrity).then(content => {
|
|
61
|
+
const sri = content.sri
|
|
62
|
+
const cpath = contentPath(cache, sri)
|
|
63
|
+
return fs.copyFileAsync(cpath, dest).then(() => content.size)
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
|
|
55
67
|
module.exports.hasContent = hasContent
|
|
56
68
|
function hasContent (cache, integrity) {
|
|
57
69
|
if (!integrity) { return BB.resolve(false) }
|
package/lib/entry-index.js
CHANGED
|
@@ -116,9 +116,10 @@ function lsStream (cache) {
|
|
|
116
116
|
}, new Map())
|
|
117
117
|
|
|
118
118
|
return getKeyToEntry.then(reduced => {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
for (let entry of reduced.values()) {
|
|
120
|
+
const formatted = formatEntry(cache, entry)
|
|
121
|
+
formatted && stream.push(formatted)
|
|
122
|
+
}
|
|
122
123
|
}).catch({code: 'ENOENT'}, nop)
|
|
123
124
|
})
|
|
124
125
|
})
|
package/lib/util/move-file.js
CHANGED
|
@@ -34,22 +34,18 @@ function moveFile (src, dest) {
|
|
|
34
34
|
}).then(() => {
|
|
35
35
|
// content should never change for any reason, so make it read-only
|
|
36
36
|
return BB.join(unlink(src), process.platform !== 'win32' && chmod(dest, '0444'))
|
|
37
|
-
}).catch(
|
|
38
|
-
if (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
// file doesn't already exist! let's try a rename -> copy fallback
|
|
49
|
-
if (!move) { move = require('move-concurrently') }
|
|
50
|
-
return move(src, dest, { BB, fs })
|
|
51
|
-
})
|
|
37
|
+
}).catch(() => {
|
|
38
|
+
if (!pinflight) { pinflight = require('promise-inflight') }
|
|
39
|
+
return pinflight('cacache-move-file:' + dest, () => {
|
|
40
|
+
return BB.promisify(fs.stat)(dest).catch(err => {
|
|
41
|
+
if (err.code !== 'ENOENT') {
|
|
42
|
+
// Something else is wrong here. Bail bail bail
|
|
43
|
+
throw err
|
|
44
|
+
}
|
|
45
|
+
// file doesn't already exist! let's try a rename -> copy fallback
|
|
46
|
+
if (!move) { move = require('move-concurrently') }
|
|
47
|
+
return move(src, dest, { BB, fs })
|
|
52
48
|
})
|
|
53
|
-
}
|
|
49
|
+
})
|
|
54
50
|
})
|
|
55
51
|
}
|
package/locales/en.js
CHANGED
|
@@ -20,6 +20,8 @@ x.get = (cache, key, opts) => get(cache, key, opts)
|
|
|
20
20
|
x.get.byDigest = (cache, hash, opts) => get.byDigest(cache, hash, opts)
|
|
21
21
|
x.get.stream = (cache, key, opts) => get.stream(cache, key, opts)
|
|
22
22
|
x.get.stream.byDigest = (cache, hash, opts) => get.stream.byDigest(cache, hash, opts)
|
|
23
|
+
x.get.copy = (cache, key, dest, opts) => get.copy(cache, key, dest, opts)
|
|
24
|
+
x.get.copy.byDigest = (cache, hash, dest, opts) => get.copy.byDigest(cache, hash, dest, opts)
|
|
23
25
|
x.get.info = (cache, key) => get.info(cache, key)
|
|
24
26
|
x.get.hasContent = (cache, hash) => get.hasContent(cache, hash)
|
|
25
27
|
|
package/locales/es.js
CHANGED
|
@@ -20,6 +20,8 @@ x.saca = (cache, clave, ops) => get(cache, clave, ops)
|
|
|
20
20
|
x.saca.porHacheo = (cache, hacheo, ops) => get.byDigest(cache, hacheo, ops)
|
|
21
21
|
x.saca.flujo = (cache, clave, ops) => get.stream(cache, clave, ops)
|
|
22
22
|
x.saca.flujo.porHacheo = (cache, hacheo, ops) => get.stream.byDigest(cache, hacheo, ops)
|
|
23
|
+
x.sava.copia = (cache, clave, destino, opts) => get.copy(cache, clave, destino, opts)
|
|
24
|
+
x.sava.copia.porHacheo = (cache, hacheo, destino, opts) => get.copy.byDigest(cache, hacheo, destino, opts)
|
|
23
25
|
x.saca.info = (cache, clave) => get.info(cache, clave)
|
|
24
26
|
x.saca.tieneDatos = (cache, hacheo) => get.hasContent(cache, hacheo)
|
|
25
27
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cacache",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.2",
|
|
4
4
|
"cache-version": {
|
|
5
5
|
"content": "2",
|
|
6
6
|
"index": "5"
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"twitter": "ReBeccaOrg"
|
|
57
57
|
}
|
|
58
58
|
],
|
|
59
|
-
"license": "
|
|
59
|
+
"license": "ISC",
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"bluebird": "^3.5.0",
|
|
62
62
|
"chownr": "^1.0.1",
|
|
@@ -68,21 +68,21 @@
|
|
|
68
68
|
"move-concurrently": "^1.0.1",
|
|
69
69
|
"promise-inflight": "^1.0.1",
|
|
70
70
|
"rimraf": "^2.6.1",
|
|
71
|
-
"ssri": "^
|
|
71
|
+
"ssri": "^5.0.0",
|
|
72
72
|
"unique-filename": "^1.1.0",
|
|
73
73
|
"y18n": "^3.2.1"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"benchmark": "^2.1.4",
|
|
77
|
-
"chalk": "^
|
|
77
|
+
"chalk": "^2.0.1",
|
|
78
78
|
"cross-env": "^5.0.1",
|
|
79
|
-
"nyc": "^11.0
|
|
80
|
-
"require-inject": "^1.4.
|
|
81
|
-
"safe-buffer": "^5.1.
|
|
79
|
+
"nyc": "^11.1.0",
|
|
80
|
+
"require-inject": "^1.4.2",
|
|
81
|
+
"safe-buffer": "^5.1.1",
|
|
82
82
|
"standard": "^10.0.2",
|
|
83
83
|
"standard-version": "^4.2.0",
|
|
84
84
|
"tacks": "^1.2.2",
|
|
85
|
-
"tap": "^10.
|
|
85
|
+
"tap": "^10.7.0",
|
|
86
86
|
"weallbehave": "^1.2.0",
|
|
87
87
|
"weallcontribute": "^1.0.8"
|
|
88
88
|
},
|