scambier/obsidian-text-extractor

[Feature request] Shorter filename for `.json` cache

juanbretti opened this issue · 2 comments

Is your feature request related to a problem? Please describe.

I am using your plugin.
I am creating a backup of my local drive to a encrypted drive and has a filename length limitation of 143 characters.

For some images, I have those inside a long path, so the current definition of:

const filename = `${slug}-${hash}.json`

Could be longer than 143 characters.
For example:

/Vault/.obsidian/plugins/text-extractor/cache/sm/onenote-gmbd-term-3-smart-cities-and-governments-mbd-en-bl2020j-1-32r-attachments-smart-cities-and-governments-se-image1-jpg-b33083bcd9cd6e05150e3fed5bbceb9c.json

Describe the solution you'd like

I would like to propose disable this filename definition, or include a switch to disable the slug and only keeping the hash.
As I can see on https://github.com/scambier/obsidian-text-extractor/blob/90cc33ca114cae9548336a52ea272e60510dbf5f/lib/src/cache.ts

Describe alternatives you've considered

What I am doing now, is trimming my folder names to just a few characters, so the slug is less than 143.

jwhco commented

I second this. I was trying to commit the cache so it wouldn't have to be regenerated on my other system. GitHub only allows path names less than 256.

A path like .obsidian/plugins/text-extractor/cache/00/sort-onenote-abr-catalog-l0423a-writing-procedural-documents-assets-00-writing-a-procedure-problem-solving-skills-from-mindtools-com-image001-jpg-02dcb8a7ed7641fab0fd7b945ae30c81.json is way too long.

How about combining the original path and file name into the hash before the json? The actual path can go in the JSON or an index file.

Thank you, #28 works perfect. This is a feature I was very much looking for.