Comments (6)
Maybe we could optionaly save very big strings (XMP, RAW) as a file to file system and make path reference instead value itself? What about temp folder used by Photoshop.
from descriptor-info.
If we're going to save to the user's file system, we should save the entire descriptor output to an external file. Maybe we have a flag like this?
var descFlags = {
reference : false,
extended : false,
maxStringLimit : 5000,
saveToFile : '~/Desktop/output.json'
};
If the user sets a maxStringLimit, then it'll use that for any string (RAW, XMP, etc), otherwise it defaults to 10,000 max.
If the user sets the saveToFile flag, then it will only save to file, without a max string limit. The only downside is that this method will not return anything in JSX, since it could crash. Thoughts?
from descriptor-info.
I think there should be some faster way how to save data to file. I will try to do some measurements what is fastest way for saving data. Maybe is problem stroting long text in variable? Maybe variable should have always only part of string? Like a buffer?
Is there any chance run saving in separated thread? Can we use setTimeout?
I am also not sure if all raw data should be in one file. Maybe we could save it into separated files in one folder?
from descriptor-info.
I can confirm that. If you save Raw data into file without writing it in variable then it's pretty fast.
var count = 0;
function saveTxt(txt)
{
var Name = app.activeDocument.name.replace(/\.[^\.]+$/, '');
var Ext = decodeURI(app.activeDocument.name).replace(/^.*\./,'');
if (Ext.toLowerCase() != 'psd')
return;
var Path = app.activeDocument.path;
var saveFile = File(Path + "/" + "descriptor-data" + count+".bin");
count++;
if(saveFile.exists)
saveFile.remove();
saveFile.encoding = "UTF8";
saveFile.open("e", "TEXT", "????");
saveFile.writeln(txt);
saveFile.close();
}
case 'DescValueType.RAWTYPE':
if(theDesc.getData( position ).length > this.descParams.maxRawLimit){
saveTxt(theDesc.getData( position ));
}
return theDesc.getData( position ).substring( 0, this.descParams.maxRawLimit );
break;
from descriptor-info.
It seems that script doesn't has problem store 1,5MB text in variable. The problem is if you want save it as JSON file. Probably JSON processing takes most time. So if JSON has to process a few milion character less then it runs faster :-)
Saving files itself is not problem.
from descriptor-info.
This was implemented in #12
from descriptor-info.
Related Issues (11)
- Action Reference HOT 10
- descriptor to JSON is already buil-in in Photoshop HOT 11
- Missing info about unit in UnitDoubleType
- Internal error (require failed) on Ps 22.4
- List of messed StringIDs and CharIDs
- Raw format problem HOT 2
- error in _getDescList
- It can't read all data from new guideline event in CC2014
- Script gets stuck when analyzing 3D layer HOT 2
- debugger param? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from descriptor-info.