Skip to content

Instantly share code, notes, and snippets.

View supunUOM's full-sized avatar
🎯
Focusing

supun supunUOM

🎯
Focusing
  • University Of Moratuwa
  • Sri Lanka
View GitHub Profile
@supunUOM
supunUOM / HttpStatusCode.ts
Last active September 11, 2023 09:15 — forked from scokmen/HttpStatusCode.ts
Typescript Http Status Codes Enum
request ok = OK
save success = CREATED
update failed = NOT_MODIFIED
client reuqest error = BAD_REQUEST
UNAUTHORIZED
enum HttpStatusCode {
/**
@supunUOM
supunUOM / download-file.js
Created October 21, 2021 13:50 — forked from javilobo8/download-file.js
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);