How can i make 'text' to 'downloadable url'?












0















I make chrome extension, which download some files from website.
i want write some log with txt file, because my program has some error and i want save error to txt file.



but i can't find how to do it.



someone say it's impossible.
i try to search, some questions say just 'app' can do it, but extension can't.
if i want this functions, i must change my program to web app? but i don't know anything about that...



'download file' is possible, download is write file to filesystem.
i think, 'write text file' is so easy work then download image and sound files....



why not??? what's diffrent??



i see many questions, blog and document, but i cant know clearly.



*to sum up



I want make some text to downloadable file. If i can get downloadable file and it's url, everything is perfect.



i see this extension, i think i can do it. but i don't know how to do it.
please teach me how do it!



https://chrome.google.com/webstore/detail/save-text-to-file/mkepenkbhepjelljcfiooignmpfgochi/related










share|improve this question




















  • 1





    This question is asked regularly and the answer is still the same. If you don't want to use an additional external utility, extensions can only download to the default downloads directory using chrome.downloads API just like the extension you've linked does so simply inspect its source code and see the documentation.

    – wOxxOm
    Nov 25 '18 at 14:08











  • @ wOxxOm I already read document of chrome.downloads. but i cant understand how to download my text! i think download api is key, but "how to make text to downloadable url" is not written. that's my questions.

    – Redwings
    Nov 27 '18 at 2:18











  • Ah, I see. It's shown in the answer below.

    – wOxxOm
    Nov 27 '18 at 5:16
















0















I make chrome extension, which download some files from website.
i want write some log with txt file, because my program has some error and i want save error to txt file.



but i can't find how to do it.



someone say it's impossible.
i try to search, some questions say just 'app' can do it, but extension can't.
if i want this functions, i must change my program to web app? but i don't know anything about that...



'download file' is possible, download is write file to filesystem.
i think, 'write text file' is so easy work then download image and sound files....



why not??? what's diffrent??



i see many questions, blog and document, but i cant know clearly.



*to sum up



I want make some text to downloadable file. If i can get downloadable file and it's url, everything is perfect.



i see this extension, i think i can do it. but i don't know how to do it.
please teach me how do it!



https://chrome.google.com/webstore/detail/save-text-to-file/mkepenkbhepjelljcfiooignmpfgochi/related










share|improve this question




















  • 1





    This question is asked regularly and the answer is still the same. If you don't want to use an additional external utility, extensions can only download to the default downloads directory using chrome.downloads API just like the extension you've linked does so simply inspect its source code and see the documentation.

    – wOxxOm
    Nov 25 '18 at 14:08











  • @ wOxxOm I already read document of chrome.downloads. but i cant understand how to download my text! i think download api is key, but "how to make text to downloadable url" is not written. that's my questions.

    – Redwings
    Nov 27 '18 at 2:18











  • Ah, I see. It's shown in the answer below.

    – wOxxOm
    Nov 27 '18 at 5:16














0












0








0








I make chrome extension, which download some files from website.
i want write some log with txt file, because my program has some error and i want save error to txt file.



but i can't find how to do it.



someone say it's impossible.
i try to search, some questions say just 'app' can do it, but extension can't.
if i want this functions, i must change my program to web app? but i don't know anything about that...



'download file' is possible, download is write file to filesystem.
i think, 'write text file' is so easy work then download image and sound files....



why not??? what's diffrent??



i see many questions, blog and document, but i cant know clearly.



*to sum up



I want make some text to downloadable file. If i can get downloadable file and it's url, everything is perfect.



i see this extension, i think i can do it. but i don't know how to do it.
please teach me how do it!



https://chrome.google.com/webstore/detail/save-text-to-file/mkepenkbhepjelljcfiooignmpfgochi/related










share|improve this question
















I make chrome extension, which download some files from website.
i want write some log with txt file, because my program has some error and i want save error to txt file.



but i can't find how to do it.



someone say it's impossible.
i try to search, some questions say just 'app' can do it, but extension can't.
if i want this functions, i must change my program to web app? but i don't know anything about that...



'download file' is possible, download is write file to filesystem.
i think, 'write text file' is so easy work then download image and sound files....



why not??? what's diffrent??



i see many questions, blog and document, but i cant know clearly.



*to sum up



I want make some text to downloadable file. If i can get downloadable file and it's url, everything is perfect.



i see this extension, i think i can do it. but i don't know how to do it.
please teach me how do it!



https://chrome.google.com/webstore/detail/save-text-to-file/mkepenkbhepjelljcfiooignmpfgochi/related







google-chrome-extension






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 28 '18 at 11:49







Redwings

















asked Nov 25 '18 at 13:34









RedwingsRedwings

688




688








  • 1





    This question is asked regularly and the answer is still the same. If you don't want to use an additional external utility, extensions can only download to the default downloads directory using chrome.downloads API just like the extension you've linked does so simply inspect its source code and see the documentation.

    – wOxxOm
    Nov 25 '18 at 14:08











  • @ wOxxOm I already read document of chrome.downloads. but i cant understand how to download my text! i think download api is key, but "how to make text to downloadable url" is not written. that's my questions.

    – Redwings
    Nov 27 '18 at 2:18











  • Ah, I see. It's shown in the answer below.

    – wOxxOm
    Nov 27 '18 at 5:16














  • 1





    This question is asked regularly and the answer is still the same. If you don't want to use an additional external utility, extensions can only download to the default downloads directory using chrome.downloads API just like the extension you've linked does so simply inspect its source code and see the documentation.

    – wOxxOm
    Nov 25 '18 at 14:08











  • @ wOxxOm I already read document of chrome.downloads. but i cant understand how to download my text! i think download api is key, but "how to make text to downloadable url" is not written. that's my questions.

    – Redwings
    Nov 27 '18 at 2:18











  • Ah, I see. It's shown in the answer below.

    – wOxxOm
    Nov 27 '18 at 5:16








1




1





This question is asked regularly and the answer is still the same. If you don't want to use an additional external utility, extensions can only download to the default downloads directory using chrome.downloads API just like the extension you've linked does so simply inspect its source code and see the documentation.

– wOxxOm
Nov 25 '18 at 14:08





This question is asked regularly and the answer is still the same. If you don't want to use an additional external utility, extensions can only download to the default downloads directory using chrome.downloads API just like the extension you've linked does so simply inspect its source code and see the documentation.

– wOxxOm
Nov 25 '18 at 14:08













@ wOxxOm I already read document of chrome.downloads. but i cant understand how to download my text! i think download api is key, but "how to make text to downloadable url" is not written. that's my questions.

– Redwings
Nov 27 '18 at 2:18





@ wOxxOm I already read document of chrome.downloads. but i cant understand how to download my text! i think download api is key, but "how to make text to downloadable url" is not written. that's my questions.

– Redwings
Nov 27 '18 at 2:18













Ah, I see. It's shown in the answer below.

– wOxxOm
Nov 27 '18 at 5:16





Ah, I see. It's shown in the answer below.

– wOxxOm
Nov 27 '18 at 5:16












1 Answer
1






active

oldest

votes


















3














This is what I understand from your question that you want to write some text into .txt file and it should be automatically downloaded for your users. For that, here I am writing code in JavaScript which will surely helps you.



var fileText = "Your content which you want to save in file";

var fileBlob = new Blob([fileText], {
type: 'text/plain'
});
var fileUrl = URL.createObjectURL(fileBlob);
var fileName = 'mytextfile.txt';

var fileOptions = {
filename: fileName,
url: fileUrl,
conflictAction: 'uniquify'
};
fileOptions.saveAs = true;


It will automatically download mytextfile.txt file with your given contents. You can implement this logic in your chrome extension as per your way.






share|improve this answer
























  • i'll try it. thanks! if i success,i select your answer.

    – Redwings
    Nov 27 '18 at 2:08











  • This is perferctly work for me! I want this!!! thanks!!!

    – Redwings
    Nov 27 '18 at 8:57











  • Thank you @Redwings

    – Ghanshyam Katriya
    Nov 27 '18 at 10:12











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53468010%2fhow-can-i-make-text-to-downloadable-url%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









3














This is what I understand from your question that you want to write some text into .txt file and it should be automatically downloaded for your users. For that, here I am writing code in JavaScript which will surely helps you.



var fileText = "Your content which you want to save in file";

var fileBlob = new Blob([fileText], {
type: 'text/plain'
});
var fileUrl = URL.createObjectURL(fileBlob);
var fileName = 'mytextfile.txt';

var fileOptions = {
filename: fileName,
url: fileUrl,
conflictAction: 'uniquify'
};
fileOptions.saveAs = true;


It will automatically download mytextfile.txt file with your given contents. You can implement this logic in your chrome extension as per your way.






share|improve this answer
























  • i'll try it. thanks! if i success,i select your answer.

    – Redwings
    Nov 27 '18 at 2:08











  • This is perferctly work for me! I want this!!! thanks!!!

    – Redwings
    Nov 27 '18 at 8:57











  • Thank you @Redwings

    – Ghanshyam Katriya
    Nov 27 '18 at 10:12
















3














This is what I understand from your question that you want to write some text into .txt file and it should be automatically downloaded for your users. For that, here I am writing code in JavaScript which will surely helps you.



var fileText = "Your content which you want to save in file";

var fileBlob = new Blob([fileText], {
type: 'text/plain'
});
var fileUrl = URL.createObjectURL(fileBlob);
var fileName = 'mytextfile.txt';

var fileOptions = {
filename: fileName,
url: fileUrl,
conflictAction: 'uniquify'
};
fileOptions.saveAs = true;


It will automatically download mytextfile.txt file with your given contents. You can implement this logic in your chrome extension as per your way.






share|improve this answer
























  • i'll try it. thanks! if i success,i select your answer.

    – Redwings
    Nov 27 '18 at 2:08











  • This is perferctly work for me! I want this!!! thanks!!!

    – Redwings
    Nov 27 '18 at 8:57











  • Thank you @Redwings

    – Ghanshyam Katriya
    Nov 27 '18 at 10:12














3












3








3







This is what I understand from your question that you want to write some text into .txt file and it should be automatically downloaded for your users. For that, here I am writing code in JavaScript which will surely helps you.



var fileText = "Your content which you want to save in file";

var fileBlob = new Blob([fileText], {
type: 'text/plain'
});
var fileUrl = URL.createObjectURL(fileBlob);
var fileName = 'mytextfile.txt';

var fileOptions = {
filename: fileName,
url: fileUrl,
conflictAction: 'uniquify'
};
fileOptions.saveAs = true;


It will automatically download mytextfile.txt file with your given contents. You can implement this logic in your chrome extension as per your way.






share|improve this answer













This is what I understand from your question that you want to write some text into .txt file and it should be automatically downloaded for your users. For that, here I am writing code in JavaScript which will surely helps you.



var fileText = "Your content which you want to save in file";

var fileBlob = new Blob([fileText], {
type: 'text/plain'
});
var fileUrl = URL.createObjectURL(fileBlob);
var fileName = 'mytextfile.txt';

var fileOptions = {
filename: fileName,
url: fileUrl,
conflictAction: 'uniquify'
};
fileOptions.saveAs = true;


It will automatically download mytextfile.txt file with your given contents. You can implement this logic in your chrome extension as per your way.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 25 '18 at 19:34









Ghanshyam KatriyaGhanshyam Katriya

649725




649725













  • i'll try it. thanks! if i success,i select your answer.

    – Redwings
    Nov 27 '18 at 2:08











  • This is perferctly work for me! I want this!!! thanks!!!

    – Redwings
    Nov 27 '18 at 8:57











  • Thank you @Redwings

    – Ghanshyam Katriya
    Nov 27 '18 at 10:12



















  • i'll try it. thanks! if i success,i select your answer.

    – Redwings
    Nov 27 '18 at 2:08











  • This is perferctly work for me! I want this!!! thanks!!!

    – Redwings
    Nov 27 '18 at 8:57











  • Thank you @Redwings

    – Ghanshyam Katriya
    Nov 27 '18 at 10:12

















i'll try it. thanks! if i success,i select your answer.

– Redwings
Nov 27 '18 at 2:08





i'll try it. thanks! if i success,i select your answer.

– Redwings
Nov 27 '18 at 2:08













This is perferctly work for me! I want this!!! thanks!!!

– Redwings
Nov 27 '18 at 8:57





This is perferctly work for me! I want this!!! thanks!!!

– Redwings
Nov 27 '18 at 8:57













Thank you @Redwings

– Ghanshyam Katriya
Nov 27 '18 at 10:12





Thank you @Redwings

– Ghanshyam Katriya
Nov 27 '18 at 10:12


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53468010%2fhow-can-i-make-text-to-downloadable-url%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

Calculate evaluation metrics using cross_val_predict sklearn

Insert data from modal to MySQL (multiple modal on website)