Skip to content

Instantly share code, notes, and snippets.

View bigxixi's full-sized avatar

Big XiXi bigxixi

View GitHub Profile
@abynim
abynim / Sketch Plugin Snippet - Managing Files.js
Last active April 30, 2024 10:02
Sketch Plugin functions for working with files.
var writeTextToFile = function(text, filePath) {
var t = [NSString stringWithFormat:@"%@", text],
f = [NSString stringWithFormat:@"%@", filePath];
return [t writeToFile:f atomically:true encoding:NSUTF8StringEncoding error:nil];
}
var readTextFromFile = function(filePath) {
var fileManager = [NSFileManager defaultManager];
if([fileManager fileExistsAtPath:filePath]) {
return [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];