@paradisec/proxyist-adapter-local
Advanced tools
Comparing version 0.2.18 to 0.3.0
import fs from 'node:fs'; | ||
const createAdapter = async (config) => { | ||
const getPath = (identifier, filename) => { | ||
const getDirectory = (identifier) => { | ||
const path = config.transform(identifier); | ||
return `${config.directory}/${path}/${filename}`; | ||
return `${config.directory}/${path}`; | ||
}; | ||
const getPath = (identifier, filename) => { | ||
const directory = getDirectory(identifier); | ||
return `${directory}/${filename}`; | ||
}; | ||
const exists = async (identifier, filename) => { | ||
@@ -28,2 +32,9 @@ const path = getPath(identifier, filename); | ||
}; | ||
const listFiles = async (identifier) => { | ||
const directory = getDirectory(identifier); | ||
if (!fs.existsSync(directory)) { | ||
return []; | ||
} | ||
return fs.readdirSync(directory, { recursive: true, encoding: 'utf8' }); | ||
}; | ||
return { | ||
@@ -34,4 +45,5 @@ exists, | ||
rm, | ||
listFiles, | ||
}; | ||
}; | ||
export default createAdapter; |
{ | ||
"name": "@paradisec/proxyist-adapter-local", | ||
"version": "0.2.18", | ||
"version": "0.3.0", | ||
"description": "Local filesystem adapter for proxyist", | ||
@@ -9,4 +9,4 @@ "exports": "./dist/index.js", | ||
"dependencies": { | ||
"@paradisec/proxyist": "^0.2.18", | ||
"@paradisec/proxyist-adapter-common": "^0.2.18" | ||
"@paradisec/proxyist": "^0.3.0", | ||
"@paradisec/proxyist-adapter-common": "^0.3.0" | ||
}, | ||
@@ -20,3 +20,3 @@ "type": "module", | ||
"devDependencies": { | ||
"@paradisec/proxyist-adapter-tests": "^0.2.18", | ||
"@paradisec/proxyist-adapter-tests": "^0.3.0", | ||
"@tsconfig/node18": "^18.2.0", | ||
@@ -41,3 +41,3 @@ "@tsconfig/strictest": "^2.0.1", | ||
], | ||
"gitHead": "1790b039c03d0db49fe7581481a820d03985737e" | ||
"gitHead": "d71986530df347270e90edf7ebe10b844ec7855e" | ||
} |
@@ -11,8 +11,14 @@ import fs from 'node:fs'; | ||
const createAdapter: ProxyistCreateAdapter<LocalAdapterConfig> = async (config) => { | ||
const getPath = (identifier: string, filename: string) => { | ||
const getDirectory = (identifier: string) => { | ||
const path = config.transform(identifier); | ||
return `${config.directory}/${path}/${filename}`; | ||
return `${config.directory}/${path}`; | ||
}; | ||
const getPath = (identifier: string, filename: string) => { | ||
const directory = getDirectory(identifier); | ||
return `${directory}/${filename}`; | ||
}; | ||
const exists = async (identifier: string, filename: string) => { | ||
@@ -48,2 +54,12 @@ const path = getPath(identifier, filename); | ||
const listFiles = async (identifier: string) => { | ||
const directory = getDirectory(identifier); | ||
if (!fs.existsSync(directory)) { | ||
return []; | ||
} | ||
return fs.readdirSync(directory, { recursive: true, encoding: 'utf8' }); | ||
}; | ||
return { | ||
@@ -54,2 +70,3 @@ exists, | ||
rm, | ||
listFiles, | ||
}; | ||
@@ -56,0 +73,0 @@ }; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6181
106
+ Added@paradisec/proxyist@0.3.0(transitive)
+ Added@paradisec/proxyist-adapter-common@0.3.0(transitive)
- Removed@paradisec/proxyist@0.2.18(transitive)
- Removed@paradisec/proxyist-adapter-common@0.2.18(transitive)
Updated@paradisec/proxyist@^0.3.0