question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question about how to newly added resource

See original GitHub issue

Hi, thank you for creating this wonderful project.

I’m using sirv with sapper to serve some static images. And these images can be uploaded through back-end. Then these images will be relocated to sirv’s dir.

Because sirv will only scan file-system once when it’s imported, these newly added images will not exists in cache, so you get 404 when visit these images in browser.

So my question is, can we add some logic, like lookup file-system when resource not found, to handle newly added resource?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
lukeedcommented, Jun 29, 2020

Hey, than you 😃

There’s no way to expose/update the cache post-startup. This is intentional. What I would recommend doing is organizing your assets in such a way that your assets (the website’s) are in one location, and the dynamic, user-uploaded images are somewhere else.

Then you would run two instances of sirv – a “dev” variant for the user images (since theyre transient) and “prod” for your own.

PS: You also would not want a never-ending supply of images being added to your internal cache. That would cause high memory usage very very quickly.

The final snippet would roughly look something like this:

sirv('public/static'); //~> cache instance on your own assets
sirv('public/uploads', { dev: true }); // -> fs reads on dynamic asset supply

Hope that helps!

1reaction
lukeedcommented, Jan 22, 2021

Thanks. Feel free to open an issue/RFC and it can collect feedback. Please include any relevant API/option suggestions for how it might be done, because at this point I can’t imagine a non-confusing way to distinguish between “just what’s here”, “use file system”, and “do both”.

It might be worth considering for a 2.0 at some point – at which time I’ll also be sure to rename the option.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can not get newly added files from Resources.resx
I've tried seting Access Modifier in Resources.resx to Internal and Public hoping to solve that problem, but then I get error in Resources....
Read more >
Three questions to ask before using a new digital resource
Here, Michael Windelspecht talks through three key questions to ask before making a choice, filmed as part of REMOTE: The Connected Faculty ...
Read more >
Move resources to a new resource group or subscription
Use Azure Resource Manager to move resources to a new resource group or subscription.
Read more >
Problem adding resources in MS Project
The purpose of this view is to list each resource assignment below the relevant task. Check if you're using the Task Usage view...
Read more >
Resource Questions - SDP help desk guide - ServiceDesk Plus
On the resource questions list view page, click New Question. ... Add choices manually - Enter your choice in the Option text box...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found