添加简历生成项目文件
- 添加 .gitignore 配置 - 添加 HTML 简历模板 (resume.html) - 添加转换脚本 (convert.js, convert.py) - 添加字体下载脚本 (download_font.js) - 添加项目配置 (package.json)
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
const https = require('https');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
function downloadFile(url, dest) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const file = fs.createWriteStream(dest);
|
||||
https.get(url, (response) => {
|
||||
response.pipe(file);
|
||||
file.on('finish', () => {
|
||||
file.close();
|
||||
resolve();
|
||||
});
|
||||
}).on('error', (err) => {
|
||||
fs.unlink(dest, () => {});
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async function downloadFonts() {
|
||||
const fontsDir = path.join(__dirname, 'fonts');
|
||||
|
||||
// Download Noto Sans SC Regular
|
||||
const regularUrl = 'https://fonts.gstatic.com/s/notosanssc/v37/k3kCo84MPvpLmixcA63oeAL7Iqp5IZJF9bmaG9_FnYxNbPzS5HE.ttf';
|
||||
const boldUrl = 'https://fonts.gstatic.com/s/notosanssc/v37/k3kCo84MPvpLmixcA63oeAL7Iqp5IZJF9bmaG9_EnYxNbPzS5HE.ttf';
|
||||
|
||||
try {
|
||||
await downloadFile(regularUrl, path.join(fontsDir, 'NotoSansSC-Regular.ttf'));
|
||||
console.log('Downloaded NotoSansSC-Regular.ttf');
|
||||
await downloadFile(boldUrl, path.join(fontsDir, 'NotoSansSC-Bold.ttf'));
|
||||
console.log('Downloaded NotoSansSC-Bold.ttf');
|
||||
} catch (err) {
|
||||
console.error('Error downloading fonts:', err);
|
||||
}
|
||||
}
|
||||
|
||||
downloadFonts();
|
||||
Reference in New Issue
Block a user