Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

read-cache

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

read-cache

Reads and caches the entire contents of a file until it is modified

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
13M
increased by9.06%
Maintainers
1
Weekly downloads
 
Created

What is read-cache?

The `read-cache` npm package is designed to read and cache the contents of files in memory. This can significantly improve performance for applications that need to read the same files multiple times, as it avoids unnecessary disk I/O after the initial read. The cache is automatically updated if the file changes, ensuring that the application always has access to the latest version of the file contents.

What are read-cache's main functionalities?

Reading and caching file contents

This feature allows you to read the contents of a file and cache it for future reads. The function returns a promise that resolves with the file's contents.

const readCache = require('read-cache');
readCache('path/to/file.txt').then(contents => {
  console.log(contents);
});

Synchronously reading and caching file contents

Similar to the asynchronous version, this feature allows for synchronous reading and caching of file contents, useful in scenarios where asynchronous operations are not possible or desired.

const readCache = require('read-cache');
const contents = readCache.sync('path/to/file.txt');
console.log(contents);

Other packages similar to read-cache

Keywords

FAQs

Package last updated on 11 Jan 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc