Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support custom url -> file path in Node File System Persister #496

Open
jeswr opened this issue May 29, 2024 · 0 comments
Open

feat: support custom url -> file path in Node File System Persister #496

jeswr opened this issue May 29, 2024 · 0 comments

Comments

@jeswr
Copy link

jeswr commented May 29, 2024

Description

Allow for a custom handlers to be provided to the Node File System Persister for converting urls to file paths.

The use case that we have for this is so that we can hash the URL rather than creating a long path from the URL (comunica/comunica#1363 (comment)) - as the paths we are generating are too long for Windows machines which often have a MAX_PATH of ~256 chars (comunica/comunica#1363 (comment)). This could be configurable as an additional persisterOption in the setupPolly function like so:

  return setupPolly({
    adapters: [ NodeHttpAdapter ],
    persister: FSPersister,
    persisterOptions: { fs: { recordingsDir, urlToPath: (url: string) => md5(url) }},
    recordFailedRequests: true,
    matchRequestsBy: {
      headers: {
        exclude: [ 'user-agent' ],
      },
    },
  });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant