summaryrefslogtreecommitdiff
path: root/cli/http_cache.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/http_cache.rs')
-rw-r--r--cli/http_cache.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/cli/http_cache.rs b/cli/http_cache.rs
index 73d569851..7310c9e92 100644
--- a/cli/http_cache.rs
+++ b/cli/http_cache.rs
@@ -17,6 +17,8 @@ use std::io;
use std::path::Path;
use std::path::PathBuf;
+pub const CACHE_PERM: u32 = 0o644;
+
/// Turn base of url (scheme, hostname, port) into a valid filename.
/// This method replaces port part with a special string token (because
/// ":" cannot be used in filename on some platforms).
@@ -85,7 +87,7 @@ impl Metadata {
pub fn write(&self, cache_filename: &Path) -> Result<(), AnyError> {
let metadata_filename = Self::filename(cache_filename);
let json = serde_json::to_string_pretty(self)?;
- deno_fs::write_file(&metadata_filename, json, 0o666)?;
+ deno_fs::write_file(&metadata_filename, json, CACHE_PERM)?;
Ok(())
}
@@ -159,7 +161,7 @@ impl HttpCache {
.expect("Cache filename should have a parent dir");
self.ensure_dir_exists(parent_filename)?;
// Cache content
- deno_fs::write_file(&cache_filename, content, 0o666)?;
+ deno_fs::write_file(&cache_filename, content, CACHE_PERM)?;
let metadata = Metadata {
url: url.to_string(),