Write Binary to Disk

Hey n8n community,
I have been using n8n a bit and am now trying to get some automation for GitHub stats going.
Mostly things like no. of stars, forks ect.

So i set up a GitHub node to fetch data from repo, which works fine.
In the next step I extract the data from the json response and parse it to a html table.

Then I would save said table to disk, and everything seems to work fine,
I just cant figure out where the file is or why it is not actually saved to disk.

Running n8n locally.

Did you check the .n8n directory? as you didnt specifiy a path

Thanks for the tip,
I just checked it, but there is only a config file.

Try specifying a path, see if it’s outputted there

Yes specifying the full path should solve that problem. At least if npm installed. For people that run it with Docker it is important to mount a folder to which files can be written

Sorry,
but specifiying the full path did not really change it, but I am getting a more specific error at least.
Now I get
"No binary data set. So file can not be written!"
I use the node version, so no docker.

Is my approach completely wrong somewhere?

Maybe I should add what I am trying to achieve:
I am looking to pull some daily basic stats from different APIs (github, twitter, youtube …) and combine them in a table for diagrams ect. down the line.

Happy to turn this into an example node if i get it working :slight_smile:

    {
      "nodes": [
        {
          "parameters": {},
          "name": "Start",
          "type": "n8n-nodes-base.start",
          "typeVersion": 1,
          "position": [
            220,
            110
          ]
        },
        {
          "parameters": {
            "functionCode": "function formatDate(date) {\n    var d = new Date(date),\n        month = '' + (d.getMonth() + 1),\n        day = '' + d.getDate(),\n        year = d.getFullYear();\n\n    if (month.length < 2) \n        month = '0' + month;\n    if (day.length < 2) \n        day = '0' + day;\n\n    return [day, month, year].join('.');\n}\n\nconst formattedStars = {\n  date : formatDate(new Date()),\n  stars : items[0].json[\"stargazers_count\"],\n}\nreturn [{json : formattedStars}];"
          },
          "name": "Function5",
          "type": "n8n-nodes-base.function",
          "typeVersion": 1,
          "position": [
            580,
            110
          ]
        },
        {
          "parameters": {
            "operation": "toFile",
            "fileFormat": "html",
            "options": {}
          },
          "name": "Spreadsheet File2",
          "type": "n8n-nodes-base.spreadsheetFile",
          "typeVersion": 1,
          "position": [
            750,
            110
          ]
        },
        {
          "parameters": {
            "options": {
              "rawData": true
            }
          },
          "name": "Spreadsheet File",
          "type": "n8n-nodes-base.spreadsheetFile",
          "typeVersion": 1,
          "position": [
            930,
            110
          ]
        },
        {
          "parameters": {
            "fileName": "=/Users/vinckr/tmp/"
          },
          "name": "Write Binary File",
          "type": "n8n-nodes-base.writeBinaryFile",
          "typeVersion": 1,
          "position": [
            1100,
            110
          ],
          "notesInFlow": false
        },
        {
          "parameters": {
            "resource": "repository",
            "operation": "get",
            "owner": "torvalds",
            "repository": "=linux"
          },
          "name": "GHStats",
          "type": "n8n-nodes-base.github",
          "typeVersion": 1,
          "position": [
            420,
            110
          ],
          "credentials": {
            "githubApi": "n8n-github"
          }
        }
      ],
      "connections": {
        "Start": {
          "main": [
            [
              {
                "node": "GHStats",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Function5": {
          "main": [
            [
              {
                "node": "Spreadsheet File2",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Spreadsheet File2": {
          "main": [
            [
              {
                "node": "Spreadsheet File",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Spreadsheet File": {
          "main": [
            [
              {
                "node": "Write Binary File",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "GHStats": {
          "main": [
            [
              {
                "node": "Function5",
                "type": "main",
                "index": 0
              }
            ]
          ]
        }
      }
    }

Option 1: Try deleting the read from spreadsheet as it will return JSON and the write binary file is looking for binary data.
Option 2: Insert a “Move Binary Data” node set to From Json to Binary before the Write to binary file

Thanks a ton for being so patient, both options work :heart_eyes:

I will share my completed workflow when I got it all set up.

Good to hear that it worked :slight_smile: