{"id":45064,"library":"gulp-cache","title":"gulp-cache","description":"A temp file based caching proxy task for Gulp. Currently at version 1.1.3 (stable), with a maintenance status as the package is not actively developed. It caches the output of any Gulp plugin based on file contents or custom keys, reducing repeated processing. Unlike other caching approaches, it stores full plugin output in a swap file cache, and supports custom success/value extractors for result inspection. Requires Node >=8 and Gulp 4+.","status":"maintenance","version":"1.1.3","language":"javascript","source_language":"en","source_url":"https://github.com/jgable/gulp-cache","tags":["javascript","gulpplugin","gulp","cache"],"install":[{"cmd":"npm install gulp-cache","lang":"bash","label":"npm"},{"cmd":"yarn add gulp-cache","lang":"bash","label":"yarn"},{"cmd":"pnpm add gulp-cache","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency: gulp-cache is a Gulp plugin and requires Gulp as the task runner.","package":"gulp","optional":false},{"reason":"Underlying cache storage implementation.","package":"cache-swap","optional":false}],"imports":[{"note":"The default export is the cache function. Named export 'Cache' also available.","wrong":"const cache = require('gulp-cache').default","symbol":"default","correct":"import cache from 'gulp-cache'"},{"note":"Cache is a named export for the cache store class. In TypeScript, you may need to import this for type annotations.","wrong":"import Cache from 'gulp-cache'","symbol":"Cache","correct":"import { Cache } from 'gulp-cache'"},{"note":"In CommonJS, require returns the default export directly, not an object with a 'cache' property.","wrong":"const { cache } = require('gulp-cache')","symbol":"cache (CommonJS)","correct":"const cache = require('gulp-cache')"}],"quickstart":{"code":"import gulp from 'gulp';\nimport jshint from 'gulp-jshint';\nimport cache from 'gulp-cache';\n\ngulp.task('lint', () =>\n  gulp.src('src/**/*.js')\n    .pipe(cache(\n      jshint('.jshintrc'),\n      {\n        name: 'jshint-cache',\n        success: (file) => file.jshint.success,\n        value: (file) => ({ jshint: file.jshint })\n      }\n    ))\n    .pipe(jshint.reporter('default'))\n);","lang":"javascript","description":"Demonstrates basic usage of gulp-cache to cache the output of gulp-jshint, with custom success and value functions."},"warnings":[{"fix":"Upgrade to Node >=8 and Gulp >=4. Use .pipe(cache(plugin, options)) syntax.","message":"Version 1.0.0 dropped support for Node <8 and Gulp <4. The old callback-based API was removed.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Replace fileCache with the 'cache' option.","message":"The 'fileCache' option is deprecated; pass a custom Cache instance directly via options.cache or use the default.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"If you need hashing, hash the key yourself before returning.","message":"The 'key' option does NOT auto-hash; you must provide a string or Promise<string>. The returned value is used as is for cache lookup.","severity":"gotcha","affected_versions":">=0.2.0"},{"fix":"Use cache.clear() in a clean task or schedule periodic cleanup.","message":"Do not assume the cache directory is cleaned automatically. The cache persists between runs unless cleared via cache.clear() or manually removed.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Update success/file to return boolean, and value to return the object directly.","message":"In version 0.4.0 the 'success' and 'value' options changed from being functions that take a callback to sync/async functions returning a value.","severity":"breaking","affected_versions":">=0.4.0 <1.0.0"}],"env_vars":null,"search_vec":"'1.1.3':16 '4':74 '8':71 'activ':27 'approach':50 'base':7,37 'cach':3,8,30,49,60,78 'content':40 'current':13 'custom':42,63 'develop':28 'extractor':65 'file':6,39,59 'full':53 'gulp':2,12,35,73,77 'gulp-cach':1 'gulpplugin':76 'inspect':68 'javascript':75 'key':43 'mainten':20 'node':70 'output':32,55 'packag':24 'plugin':36,54 'process':46 'proxi':9 'reduc':44 'repeat':45 'requir':69 'result':67 'stabl':17 'status':21 'store':52 'success/value':64 'support':62 'swap':58 'task':10 'temp':5 'unlik':47 'version':15","created_at":"2026-06-07T12:53:12.037068+00:00","updated_at":"2026-06-07T12:53:12.037068+00:00","problems":[{"fix":"Set a custom cache directory with write permissions via options.cacheDir or environment variable.","cause":"Cache directory creation fails due to insufficient permissions (e.g., on CI or inside Docker).","error":"Error: listen EACCES: permission denied /tmp/gulp-cache/..."},{"fix":"Check that gulp.src() actually yields files. Ensure your key function handles falsy file gracefully.","cause":"The 'key' option function receives a file object that might be null/undefined, or the stream is empty.","error":"TypeError: Cannot read property 'contents' of undefined"},{"fix":"Run 'npm install --save-dev gulp-cache' or 'yarn add --dev gulp-cache'.","cause":"The package is not installed or not in node_modules.","error":"Error: Cannot find module 'gulp-cache'"},{"fix":"Use 'const cache = require('gulp-cache');' (without destructuring). Or use ESM import syntax.","cause":"Import error: CommonJS require returns an object, not a function directly.","error":"TypeError: cache is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/jgable/gulp-cache","github":"https://github.com/jgable/gulp-cache","docs":null,"changelog":null,"pypi":null,"npm":"gulp-cache","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}